public static List <int> ProcessExtensionProps(List <int> extensionPropsIDList, int skillID, int actionType)
        {
            List <int> list = new List <int>();
            List <int> result;

            if (null == extensionPropsIDList)
            {
                result = list;
            }
            else
            {
                Dictionary <int, byte> dict = new Dictionary <int, byte>();
                for (int i = 0; i < extensionPropsIDList.Count; i++)
                {
                    int id = extensionPropsIDList[i];
                    ExtensionPropItem extensionPropItem = ExtensionPropsMgr.FindCachingItem(id);
                    if (null != extensionPropItem)
                    {
                        if (extensionPropItem.ActionType == actionType)
                        {
                            if (extensionPropItem.NeedSkill.Count > 0)
                            {
                                if (!extensionPropItem.NeedSkill.ContainsKey(skillID))
                                {
                                    goto IL_C2;
                                }
                            }
                            int rndNum = Global.GetRandomNumber(0, 101);
                            if (rndNum <= extensionPropItem.Probability)
                            {
                                list.Add(id);
                                dict[id] = 1;
                            }
                        }
                    }
                    IL_C2 :;
                }
                List <int> returnList = new List <int>();
                for (int i = 0; i < list.Count; i++)
                {
                    int id = list[i];
                    ExtensionPropItem extensionPropItem = ExtensionPropsMgr.FindCachingItem(id);
                    if (null != extensionPropItem)
                    {
                        if (extensionPropItem.PrevTuoZhanShuXing.Count > 0)
                        {
                            foreach (int key in extensionPropItem.PrevTuoZhanShuXing.Keys)
                            {
                                if (!dict.ContainsKey(key))
                                {
                                }
                            }
                        }
                        returnList.Add(id);
                    }
                }
                result = returnList;
            }
            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 根据ID和获取配置项
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static ExtensionPropItem FindCachingItem(int id)
        {
            ExtensionPropItem extensionPropItem = null;

            if (!_ExtensionPropsCachingDict.TryGetValue(id, out extensionPropItem))
            {
                return(null);
            }

            return(extensionPropItem);
        }
        public static ExtensionPropItem FindCachingItem(int id)
        {
            ExtensionPropItem extensionPropItem = null;
            ExtensionPropItem result;

            if (!ExtensionPropsMgr._ExtensionPropsCachingDict.TryGetValue(id, out extensionPropItem))
            {
                result = null;
            }
            else
            {
                result = extensionPropItem;
            }
            return(result);
        }
        public static void LoadCachingItems(SystemXmlItems systemExtensionProps)
        {
            Dictionary <int, ExtensionPropItem> cachingDict = new Dictionary <int, ExtensionPropItem>();

            foreach (int key in systemExtensionProps.SystemXmlItemDict.Keys)
            {
                SystemXmlItem     systemXmlItem     = systemExtensionProps.SystemXmlItemDict[key];
                ExtensionPropItem extensionPropItem = ExtensionPropsMgr.ParseCachingItem(systemXmlItem);
                if (null != extensionPropItem)
                {
                    cachingDict[extensionPropItem.ID] = extensionPropItem;
                }
            }
            ExtensionPropsMgr._ExtensionPropsCachingDict = cachingDict;
        }
Exemple #5
0
        /// <summary>
        /// 对精灵对象执行拓展属性的公式
        /// </summary>
        /// <param name="list"></param>
        /// <param name="obj"></param>
        public static void ExecuteExtensionPropsActions(List <int> list, IObject self, IObject obj)
        {
            if (null == list || list.Count <= 0)
            {
                return;
            }

            for (int i = 0; i < list.Count; i++)
            {
                int id = list[i];
                ExtensionPropItem extensionPropItem = FindCachingItem(id);
                if (null == extensionPropItem)
                {
                    continue;
                }

                IObject targetObj = null;
                if (0 == extensionPropItem.ActionType) //主动触发
                {
                    targetObj = self;
                    if (0 != extensionPropItem.TargetType) //自身
                    {
                        targetObj = obj;
                    }
                }
                else //被动触发
                {
                    targetObj = obj;
                    if (0 != extensionPropItem.TargetType) //自身
                    {
                        targetObj = self;
                    }
                }

                List <MagicActionItem> magicActionItemList = null;
                if (GameManager.SystemMagicActionMgr.BossAIActionsDict.TryGetValue(extensionPropItem.ID, out magicActionItemList) && null != magicActionItemList)
                {
                    for (int j = 0; j < magicActionItemList.Count; j++)
                    {
                        MagicAction.ProcessAction(self, targetObj, magicActionItemList[j].MagicActionID, magicActionItemList[j].MagicActionParams);
                    }
                }

                //通知所有在线用户某个精灵的扩展属性被命中(同一个地图才需要通知)
                GameManager.ClientMgr.NotifySpriteExtensionPropsHited(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool,
                                                                      self, targetObj.GetObjectID(), (int)targetObj.CurrentPos.X, (int)targetObj.CurrentPos.Y, id);
            }
        }
Exemple #6
0
        /// <summary>
        /// 从xml项中解析缓存项
        /// </summary>
        /// <param name="systemXmlItem"></param>
        private static ExtensionPropItem ParseCachingItem(SystemXmlItem systemXmlItem)
        {
            ExtensionPropItem extensionPropItem = new ExtensionPropItem()
            {
                ID = systemXmlItem.GetIntValue("ID"),
                PrevTuoZhanShuXing = ParseDict(systemXmlItem.GetStringValue("PrevTuoZhanShuXing")),
                TargetType         = systemXmlItem.GetIntValue("TargetTyp"),
                ActionType         = systemXmlItem.GetIntValue("ActionType"),
                Probability        = (int)(systemXmlItem.GetDoubleValue("Probability") * 100),
                NeedSkill          = ParseDict(systemXmlItem.GetStringValue("NeedSkill")),
                Icon             = systemXmlItem.GetIntValue("Icon"),
                TargetDecoration = systemXmlItem.GetIntValue("TargetDecoration"),
                DelayDecoration  = systemXmlItem.GetIntValue("DelayDecoration"),
            };

            return(extensionPropItem);
        }
Exemple #7
0
        /// <summary>
        /// 加载缓存项
        /// </summary>
        public static void LoadCachingItems(SystemXmlItems systemExtensionProps)
        {
            Dictionary <int, ExtensionPropItem> cachingDict = new Dictionary <int, ExtensionPropItem>();

            foreach (var key in systemExtensionProps.SystemXmlItemDict.Keys)
            {
                SystemXmlItem     systemXmlItem     = systemExtensionProps.SystemXmlItemDict[(int)key];
                ExtensionPropItem extensionPropItem = ParseCachingItem(systemXmlItem);
                if (null == extensionPropItem) //解析出错
                {
                    continue;
                }

                cachingDict[extensionPropItem.ID] = extensionPropItem;
            }

            _ExtensionPropsCachingDict = cachingDict;
        }
 public static void ExecuteExtensionPropsActions(List <int> list, IObject self, IObject obj)
 {
     if (list != null && list.Count > 0)
     {
         for (int i = 0; i < list.Count; i++)
         {
             int id = list[i];
             ExtensionPropItem extensionPropItem = ExtensionPropsMgr.FindCachingItem(id);
             if (null != extensionPropItem)
             {
                 IObject targetObj;
                 if (0 == extensionPropItem.ActionType)
                 {
                     targetObj = self;
                     if (0 != extensionPropItem.TargetType)
                     {
                         targetObj = obj;
                     }
                 }
                 else
                 {
                     targetObj = obj;
                     if (0 != extensionPropItem.TargetType)
                     {
                         targetObj = self;
                     }
                 }
                 List <MagicActionItem> magicActionItemList = null;
                 if (GameManager.SystemMagicActionMgr.BossAIActionsDict.TryGetValue(extensionPropItem.ID, out magicActionItemList) && null != magicActionItemList)
                 {
                     for (int j = 0; j < magicActionItemList.Count; j++)
                     {
                         MagicAction.ProcessAction(self, targetObj, magicActionItemList[j].MagicActionID, magicActionItemList[j].MagicActionParams, -1, -1, 0, 1, -1, 0, 0, -1, 0, false, false, 1.0, 1, 0.0);
                     }
                 }
                 GameManager.ClientMgr.NotifySpriteExtensionPropsHited(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, self, targetObj.GetObjectID(), (int)targetObj.CurrentPos.X, (int)targetObj.CurrentPos.Y, id);
             }
         }
     }
 }
Exemple #9
0
        /// <summary>
        /// 触发拓展属性
        /// </summary>
        /// <param name="extensionPropsIDList"></param>
        /// <param name="skillID"></param>
        /// <returns></returns>
        public static List <int> ProcessExtensionProps(List <int> extensionPropsIDList, int skillID, int actionType)
        {
            List <int> list = new List <int>();

            if (null == extensionPropsIDList)
            {
                return(list);
            }

            Dictionary <int, byte> dict = new Dictionary <int, byte>();

            for (int i = 0; i < extensionPropsIDList.Count; i++)
            {
                int id = extensionPropsIDList[i];
                ExtensionPropItem extensionPropItem = FindCachingItem(id);
                if (null == extensionPropItem)
                {
                    continue;
                }

                if (extensionPropItem.ActionType != actionType) //是否是要求触发的类型
                {
                    continue;
                }

                if (extensionPropItem.NeedSkill.Count > 0) //如果需要指定技能触发
                {
                    if (!extensionPropItem.NeedSkill.ContainsKey(skillID))
                    {
                        continue;
                    }
                }

                int rndNum = Global.GetRandomNumber(0, 101);
                if (rndNum > extensionPropItem.Probability) //判断触发概率
                {
                    continue;
                }

                list.Add(id);
                dict[id] = 1;
            }

            List <int> returnList = new List <int>();

            for (int i = 0; i < list.Count; i++)
            {
                int id = list[i];
                ExtensionPropItem extensionPropItem = FindCachingItem(id);
                if (null == extensionPropItem)
                {
                    continue;
                }

                if (extensionPropItem.PrevTuoZhanShuXing.Count > 0) //如果需要前置触发
                {
                    foreach (var key in extensionPropItem.PrevTuoZhanShuXing.Keys)
                    {
                        if (!dict.ContainsKey(key))
                        {
                            continue;
                        }
                    }
                }

                returnList.Add(id);
            }

            return(returnList);
        }