Example #1
0
        public void AddSkillCoolDownForMonster(Monster monster, int skillID)
        {
            SystemXmlItem systemMagic = null;

            if (GameManager.SystemMagicQuickMgr.MagicItemsDict.TryGetValue(skillID, out systemMagic))
            {
                int cdTime = systemMagic.GetIntValue("CDTime", -1);
                if (cdTime > 0)
                {
                    int  pubCDTime = systemMagic.GetIntValue("PubCDTime", -1);
                    long nowTicks  = TimeUtil.NOW();
                    Global.AddCoolDownItem(this.SkillCoolDownDict, skillID, nowTicks, (long)(cdTime * 1000));
                    if (null != monster.MonsterInfo.SkillIDs)
                    {
                        for (int i = 0; i < monster.MonsterInfo.SkillIDs.Length; i++)
                        {
                            if (pubCDTime > 0)
                            {
                                Global.AddCoolDownItem(this.SkillCoolDownDict, monster.MonsterInfo.SkillIDs[i], nowTicks, (long)pubCDTime);
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 添加技能冷却
        /// </summary>
        /// <param name="magicCode"></param>
        public void AddSkillCoolDownForMonster(Monster monster, int skillID)
        {
            SystemXmlItem systemMagic = null;

            if (!GameManager.SystemMagicQuickMgr.MagicItemsDict.TryGetValue(skillID, out systemMagic))
            {
                return;
            }

            int cdTime = systemMagic.GetIntValue("CDTime");

            if (cdTime <= 0) //不需要CD时间
            {
                return;
            }

            int pubCDTime = systemMagic.GetIntValue("PubCDTime");

            long nowTicks = DateTime.Now.Ticks / 10000;

            Global.AddCoolDownItem(SkillCoolDownDict, skillID, nowTicks, cdTime * 1000);
            if (null != monster.MonsterInfo.SkillIDs)
            {
                for (int i = 0; i < monster.MonsterInfo.SkillIDs.Length; i++)
                {
                    if (pubCDTime > 0)
                    {
                        Global.AddCoolDownItem(SkillCoolDownDict, monster.MonsterInfo.SkillIDs[i], nowTicks, pubCDTime * 1000);
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        /// 添加物品冷却
        /// </summary>
        /// <param name="magicCode"></param>
        public void AddGoodsCoolDown(GameClient client, int goodsID)
        {
            // 物品名字索引管理
            SystemXmlItem systemGoods = null;

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

            int cdTime = systemGoods.GetIntValue("CDTime");

            if (cdTime <= 0) //不需要CD时间
            {
                return;
            }

            int pubCDTime = systemGoods.GetIntValue("PubCDTime");
            int cdGroup   = systemGoods.GetIntValue("ShareGroupID");

            long nowTicks = TimeUtil.NOW();

            Global.AddCoolDownItem(GoodsCoolDownDict, goodsID, nowTicks, cdTime * 1000);
            if (cdGroup > 0)
            {
                if (null != client.ClientData.GoodsDataList)
                {
                    for (int i = 0; i < client.ClientData.GoodsDataList.Count; i++)
                    {
                        GoodsData goodsData = client.ClientData.GoodsDataList[i];
                        if (null == goodsData)
                        {
                            continue;
                        }
                        if (goodsData.Using > 0)
                        {
                            continue;
                        }

                        SystemXmlItem systemGoods2 = null;
                        if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsData.GoodsID, out systemGoods2))
                        {
                            continue;
                        }

                        if (null == systemGoods2)
                        {
                            continue;
                        }

                        if (cdGroup == systemGoods2.GetIntValue("ShareGroupID")) //同组
                        {
                            Global.AddCoolDownItem(GoodsCoolDownDict, goodsData.GoodsID, nowTicks, pubCDTime * 1000);
                        }
                    }
                }
            }
        }
Example #4
0
        /// <summary>
        /// 添加技能冷却
        /// </summary>
        /// <param name="magicCode"></param>
        public void AddSkillCoolDownForMonster(Monster monster, int skillID)
        {
            SystemXmlItem systemMagic = null;

            if (!GameManager.SystemMagicQuickMgr.MagicItemsDict.TryGetValue(skillID, out systemMagic))
            {
                return;
            }

            int cdTime = systemMagic.GetIntValue("CDTime");

            if (cdTime <= 0) //不需要CD时间
            {
                return;
            }

            int pubCDTime = systemMagic.GetIntValue("PubCDTime");

            long nowTicks = TimeUtil.NOW();

            Global.AddCoolDownItem(SkillCoolDownDict, skillID, nowTicks, cdTime * 1000);
#if ___CC___FUCK___YOU___BB___
            if (null != monster.XMonsterInfo.Skills)
            {
                for (int i = 0; i < monster.XMonsterInfo.Skills.Count; i++)
                {
                    if (pubCDTime > 0)
                    {
                        Global.AddCoolDownItem(SkillCoolDownDict, monster.XMonsterInfo.Skills[i], nowTicks, pubCDTime /* * 1000*/);
                    }
                }
            }
#else
            if (null != monster.MonsterInfo.SkillIDs)
            {
                for (int i = 0; i < monster.MonsterInfo.SkillIDs.Length; i++)
                {
                    if (pubCDTime > 0)
                    {
                        Global.AddCoolDownItem(SkillCoolDownDict, monster.MonsterInfo.SkillIDs[i], nowTicks, pubCDTime /* * 1000*/);
                    }
                }
            }
#endif
        }
Example #5
0
        public void AddGoodsCoolDown(GameClient client, int goodsID)
        {
            SystemXmlItem systemGoods = null;

            if (GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsID, out systemGoods))
            {
                int cdTime = systemGoods.GetIntValue("CDTime", -1);
                if (cdTime > 0)
                {
                    int  pubCDTime = systemGoods.GetIntValue("PubCDTime", -1);
                    int  cdGroup   = systemGoods.GetIntValue("ShareGroupID", -1);
                    long nowTicks  = TimeUtil.NOW();
                    Global.AddCoolDownItem(this.GoodsCoolDownDict, goodsID, nowTicks, (long)(cdTime * 1000));
                    if (cdGroup > 0)
                    {
                        if (null != client.ClientData.GoodsDataList)
                        {
                            for (int i = 0; i < client.ClientData.GoodsDataList.Count; i++)
                            {
                                GoodsData goodsData = client.ClientData.GoodsDataList[i];
                                if (null != goodsData)
                                {
                                    if (goodsData.Using <= 0)
                                    {
                                        SystemXmlItem systemGoods2 = null;
                                        if (GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsData.GoodsID, out systemGoods2))
                                        {
                                            if (null != systemGoods2)
                                            {
                                                if (cdGroup == systemGoods2.GetIntValue("ShareGroupID", -1))
                                                {
                                                    Global.AddCoolDownItem(this.GoodsCoolDownDict, goodsData.GoodsID, nowTicks, (long)(pubCDTime * 1000));
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Example #6
0
        public void AddSkillCoolDownForClient(GameClient client, int skillID)
        {
            SystemXmlItem systemMagic = null;

            if (GameManager.SystemMagicQuickMgr.MagicItemsDict.TryGetValue(skillID, out systemMagic))
            {
                long nowTicks  = TimeUtil.NOW();
                int  cdTime    = Global.GMax(0, systemMagic.GetIntValue("CDTime", -1));
                int  pubCDTime = Global.GMax(0, systemMagic.GetIntValue("PubCDTime", -1));
                if (cdTime <= 0)
                {
                    int nParentMagicID = systemMagic.GetIntValue("ParentMagicID", -1);
                    if (nParentMagicID > 0)
                    {
                        if (GameManager.SystemMagicQuickMgr.MagicItemsDict.TryGetValue(nParentMagicID, out systemMagic))
                        {
                            cdTime = Global.GMax(0, systemMagic.GetIntValue("CDTime", -1));
                        }
                    }
                }
                long delayTicks = Data.MaxServerClientTimeDiff;
                if (client.ClientData.CurrentMagicCode == skillID)
                {
                    delayTicks = nowTicks - client.ClientData.CurrentMagicTicks;
                }
                if (cdTime > 0)
                {
                    cdTime *= 1000;
                    if (client.ClientData.CurrentMagicCode == skillID && client.ClientData.CurrentMagicCDSubPercent > 0.0)
                    {
                        cdTime = Convert.ToInt32((double)cdTime * (1.0 - client.ClientData.CurrentMagicCDSubPercent));
                        cdTime = (int)Math.Max((long)cdTime, delayTicks);
                        int nextMagicID = systemMagic.GetIntValue("NextMagicID", -1);
                        if (nextMagicID <= 0)
                        {
                            client.ClientData.CurrentMagicCDSubPercent = 0.0;
                        }
                    }
                    Global.AddCoolDownItem(this.SkillCoolDownDict, skillID, nowTicks, (long)cdTime - delayTicks);
                    if (systemMagic.GetStringValue("HorseSkill") == "1")
                    {
                        ExtData extData = ExtDataManager.GetClientExtData(client);
                        extData.ZuoQiSkillCDTicks = nowTicks + (long)cdTime - delayTicks;
                        extData.ZuoQiSkillCdTime  = (long)cdTime - delayTicks;
                    }
                }
                if (pubCDTime > 0)
                {
                    client.ClientData.CurrentMagicActionEndTicks = nowTicks - delayTicks + (long)pubCDTime;
                    if (null != client.ClientData.SkillDataList)
                    {
                        for (int i = 0; i < client.ClientData.SkillDataList.Count; i++)
                        {
                            SkillData skillData = client.ClientData.SkillDataList[i];
                            if (null != skillData)
                            {
                                Global.AddCoolDownItem(this.SkillCoolDownDict, skillData.SkillID, nowTicks, (long)pubCDTime - delayTicks);
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 添加技能冷却
        /// </summary>
        /// <param name="magicCode"></param>
        public void AddSkillCoolDownForClient(GameClient client, int skillID)
        {
            SystemXmlItem systemMagic = null;

            if (!GameManager.SystemMagicQuickMgr.MagicItemsDict.TryGetValue(skillID, out systemMagic))
            {
                return;
            }

            long nowTicks = TimeUtil.NOW();
            int  cdTime   = systemMagic.GetIntValue("CDTime");

            if (cdTime <= 0) //不需要CD时间
            {
                int skillType = systemMagic.GetIntValue("SkillType");
                if (skillType == 1)
                {
                    if (null != client.ClientData.SkillDataList)
                    {
                        for (int i = 0; i < client.ClientData.SkillDataList.Count; i++)
                        {
                            SkillData skillData = client.ClientData.SkillDataList[i];
                            if (null == skillData || skillData.DbID > 0)
                            {
                                continue;
                            }

                            Global.AddCoolDownItem(SkillCoolDownDict, skillData.SkillID, nowTicks, 375);//普通攻击统一加个375毫秒的CD
                        }
                    }

                    return;
                }

                //连续技能使用首段技能的CD
                int nParentMagicID = systemMagic.GetIntValue("ParentMagicID");
                if (nParentMagicID <= 0) //不需要CD时间
                {
                    return;
                }
                if (!GameManager.SystemMagicQuickMgr.MagicItemsDict.TryGetValue(nParentMagicID, out systemMagic))
                {
                    return;
                }
                cdTime = systemMagic.GetIntValue("CDTime");
                // 判断父技能的CD是否到时
                if (cdTime <= 0)
                {
                    return;
                }
            }

            int pubCDTime = systemMagic.GetIntValue("PubCDTime");

            Global.AddCoolDownItem(SkillCoolDownDict, skillID, nowTicks, cdTime * 1000 - 500);
            if (pubCDTime > 0)
            {
                if (null != client.ClientData.SkillDataList)
                {
                    for (int i = 0; i < client.ClientData.SkillDataList.Count; i++)
                    {
                        SkillData skillData = client.ClientData.SkillDataList[i];
                        if (null == skillData)
                        {
                            continue;
                        }

                        Global.AddCoolDownItem(SkillCoolDownDict, skillData.SkillID, nowTicks, pubCDTime * 1000);
                    }
                }
            }
        }