当前位置: 首页>>代码示例>>C#>>正文


C# WoWUnit.MyAuraExpiring方法代码示例

本文整理汇总了C#中WoWUnit.MyAuraExpiring方法的典型用法代码示例。如果您正苦于以下问题:C# WoWUnit.MyAuraExpiring方法的具体用法?C# WoWUnit.MyAuraExpiring怎么用?C# WoWUnit.MyAuraExpiring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WoWUnit的用法示例。


在下文中一共展示了WoWUnit.MyAuraExpiring方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Replace

        private string Replace(string prefix, string s, WoWUnit theunit)
        {
            string fnname = "FTWCore.Replace";
            MyTimer.Start(fnname);
            if (theunit != null && theunit.Guid == StyxWoW.Me.Guid)
            {
                if (StyxWoW.Me.HasAura("Eclipse (Solar)"))
                    FTWProps._eclipsedirection = -1;
                else if (StyxWoW.Me.HasAura("Eclipse (Lunar)"))
                    FTWProps._eclipsedirection = 1;
            }

            // Replace aura checks with parenthese (Target.HasMyAura("Bad Aura") > 3)
            string findstring = string.Format(@"{0}\.(?<action>.*)\(""(?<aura>.*)""\)", prefix);
            Regex rg = new Regex(findstring);
            Match match = rg.Match(s);
            Dictionary<String, Object> d = new Dictionary<String, Object>();
            while (match.Success)
            {
                if (!d.ContainsKey(match.Value))
                {
                    string action = match.Groups["action"].Value;
                    string aura = match.Groups["aura"].Value;
                    int value = 0;
                    if (false) { }
                    else if (action == "Weapon1HasAura") value = (theunit != null && FTWCoreItems.WeaponEnchant(1) == aura) ? 1 : 0;
                    else if (action == "Weapon2HasAura") value = (theunit != null && FTWCoreItems.WeaponEnchant(2) == aura) ? 1 : 0;
                    else if (action == "AuraExpiring") value = (theunit != null) ? theunit.AuraExpiring(aura) : 0;
                    else if (action == "CanCast") value = (theunit != null && SpellManager.CanCast(aura, theunit)) ? 1 : 0;
                    else if (action == "ClearBehindMe") value = (theunit != null && StyxWoW.Me.ClearBehindMe(aura) ? 1 : 0);
                    else if (action == "HasAura") value = (theunit != null && theunit.HasAura(aura)) ? 1 : 0;
                    else if (action == "HasItem") value = StyxWoW.Me.HasItem(aura) ? 1 : 0;
                    else if (action == "HasMyAura") value = (theunit != null && theunit.HasMyAura(aura)) ? 1 : 0;
                    else if (action == "HasSpell") value = (StyxWoW.Me.HasSpell(aura)) ? 1 : 0;
                    else if (action == "HasTotem") value = FTWCoreStatus.HasTotem(aura) ? 1 : 0;
                    else if (action == "IsCasting") value = (theunit != null && theunit.CurrentSpellName() == aura) ? 1 : 0;
                    else if (action == "ItemOnCooldown") value = FTWCoreItems.ItemOnCooldown(aura) ? 1 : 0;
                    else if (action == "MyAuraExpiring") value = (theunit != null) ? theunit.MyAuraExpiring(aura) : 0;
                    else if (action == "MyStackCount") value = (theunit != null) ? theunit.MyStackCount(aura) : 0;
                    else if (action == "OnCooldown") value = FTWCoreStatus.OnCooldown(aura) ? 1 : 0;
                    else if (action == "PartyWithAura") value = FTWCoreUnits.GetPartyWithAura(aura);
                    else if (action == "PartyWithHealth") value = FTWCoreUnits.GetPartyWithHealth(aura);
                    else if (action == "StackCount") value = (theunit != null) ? theunit.StackCount(aura) : 0;
                    else if (action == "NumItems") value = (theunit != null) ? FTWCoreItems.NumItems(aura) : 0;
                    else throw new Exception(string.Format("Unknown action {0}!", action));
                    d.Add(match.Value, 0);
                    s = s.Replace(match.Value, value.ToString());
                }
                match = match.NextMatch();

            }

            // Replace simple properties
            for (int i = 0; i < FTWProps.PropertyNames.Count(); i++)
            {
                string propname = FTWProps.PropertyNames[i].Trim();
                if (propname.Length > 0)
                {
                    string search = prefix + "." + propname;
                    if (s.Contains(search))
                        s = s.Replace(search, GetProperty(theunit, propname).ToString());
                }
            }

            // Stop the timer
            MyTimer.Stop(fnname);

            return s;
        }
开发者ID:psmyth1,项目名称:code-samples,代码行数:69,代码来源:FTWCore.cs


注:本文中的WoWUnit.MyAuraExpiring方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。