コード例 #1
0
        /// <summary>
        /// returns the DR level of the given target in given DR Category.
        /// </summary>
        public int GetDrLevel(WoWUnit target, DrCategory category)
        {
            if (target == null || !target.IsValid)
            {
                return(0);
            }
            var level = 0;

            switch (category)
            {
            case DrCategory.Disoriented:
                level = DisorientedTargetsLevel.ContainsKey(target) ? DisorientedTargetsLevel[target] : 0;
                break;

            case DrCategory.Stun:
                level = StunnedTargetsLevel.ContainsKey(target) ? StunnedTargetsLevel[target] : 0;
                break;

            case DrCategory.Root:
                level = RootedTargetsLevel.ContainsKey(target) ? RootedTargetsLevel[target] : 0;
                break;

            case DrCategory.Incapacitate:
                level = IncapacitatedTargetsLevel.ContainsKey(target) ? IncapacitatedTargetsLevel[target] : 0;
                break;

            case DrCategory.Silence:
                level = SilenceTargetsLevel.ContainsKey(target) ? SilenceTargetsLevel[target] : 0;
                break;
            }
            return(level);
        }
コード例 #2
0
        private void AddDr(WoWUnit target, DrCategory category)
        {
            if (target == null || !target.IsValid)
                return;

            switch (category)
            {
                case DrCategory.Disoriented:
                    if (!Instance.DisorientedTargets.ContainsKey(target))
                        Instance.DisorientedTargets.Add(target, Stopwatch.StartNew());
                    else
                    {
                        Instance.DisorientedTargets.Remove(target);
                        Instance.DisorientedTargets.Add(target, Stopwatch.StartNew());
                    }

                    if (!Instance.DisorientedTargetsLevel.ContainsKey(target))
                        Instance.DisorientedTargetsLevel.Add(target, 1);
                    else
                    {
                        var oldDrLevel = Instance.DisorientedTargetsLevel[target];
                        Instance.DisorientedTargetsLevel.Remove(target);
                        Instance.DisorientedTargetsLevel.Add(target, oldDrLevel + 1);
                    }

                    Log.Combat(String.Format("Added {0} on Desorientation DR, Level : {1}",
                        target.SafeName,
                        Instance.DisorientedTargetsLevel[target]));
                    break;
                case DrCategory.Stun:
                    if (!Instance.StunnedTargets.ContainsKey(target))
                        Instance.StunnedTargets.Add(target, Stopwatch.StartNew());
                    else
                    {
                        Instance.StunnedTargets.Remove(target);
                        Instance.StunnedTargets.Add(target, Stopwatch.StartNew());
                    }
                    if (!Instance.StunnedTargetsLevel.ContainsKey(target))
                        Instance.StunnedTargetsLevel.Add(target, 1);
                    else
                    {
                        var oldDrLevel = Instance.StunnedTargetsLevel[target];
                        Instance.StunnedTargetsLevel.Remove(target);
                        Instance.StunnedTargetsLevel.Add(target, oldDrLevel + 1);
                    }

                    Log.Combat(String.Format("Added {0} on Stun DR, Level : {1}",
                        target.SafeName,
                        Instance.StunnedTargetsLevel[target]));
                    break;
                 case DrCategory.Root:
                    if (!Instance.RootedTargets.ContainsKey(target))
                        Instance.RootedTargets.Add(target, Stopwatch.StartNew());
                    else
                    {
                        Instance.RootedTargets.Remove(target);
                        Instance.RootedTargets.Add(target, Stopwatch.StartNew());
                    }
                    if (!Instance.RootedTargetsLevel.ContainsKey(target))
                        Instance.RootedTargetsLevel.Add(target, 1);
                    else
                    {
                        var oldDrLevel = Instance.RootedTargetsLevel[target];
                        Instance.RootedTargetsLevel.Remove(target);
                        Instance.RootedTargetsLevel.Add(target, oldDrLevel + 1);
                    }

                    Log.Combat(String.Format("Added {0} on Root DR, Level : {1}",
                        target.SafeName,
                        Instance.RootedTargetsLevel[target]));
                    break;
                case DrCategory.Incapacitate:
                     if (!Instance.IncapacitatedTargets.ContainsKey(target))
                        Instance.IncapacitatedTargets.Add(target, Stopwatch.StartNew());
                    else
                    {
                        Instance.IncapacitatedTargets.Remove(target);
                        Instance.IncapacitatedTargets.Add(target, Stopwatch.StartNew());
                    }
                    if (!Instance.IncapacitatedTargetsLevel.ContainsKey(target))
                        Instance.IncapacitatedTargetsLevel.Add(target, 1);
                    else
                    {
                        var oldDrLevel = Instance.IncapacitatedTargetsLevel[target];
                        Instance.IncapacitatedTargetsLevel.Remove(target);
                        Instance.IncapacitatedTargetsLevel.Add(target, oldDrLevel + 1);
                    }

                    Log.Combat(String.Format("Added {0} on Incapacitate DR, Level : {1}",
                        target.SafeName,
                        Instance.IncapacitatedTargetsLevel[target]));
                    break;
                case DrCategory.Silence:
                     if (!Instance.SilenceTargets.ContainsKey(target))
                        Instance.SilenceTargets.Add(target, Stopwatch.StartNew());
                    else
                    {
                        Instance.SilenceTargets.Remove(target);
                        Instance.SilenceTargets.Add(target, Stopwatch.StartNew());
                    }
                    if (!Instance.SilenceTargetsLevel.ContainsKey(target))
                        Instance.SilenceTargetsLevel.Add(target, 1);
                    else
                    {
                        var oldDrLevel = Instance.SilenceTargetsLevel[target];
                        Instance.SilenceTargetsLevel.Remove(target);
                        Instance.SilenceTargetsLevel.Add(target, oldDrLevel + 1);
                    }

                    Log.Combat(String.Format("Added {0} on Silence DR, Level : {1}",
                        target.SafeName,
                        Instance.SilenceTargetsLevel[target]));
                    break;
            }
        }
コード例 #3
0
 /// <summary>
 /// returns the DR level of the given target in given DR Category.
 /// </summary>
 public int GetDrLevel(WoWUnit target, DrCategory category )
 {
     if (target == null || !target.IsValid)
         return 0;
     var level = 0;
     switch (category)
     {
         case DrCategory.Disoriented:
             level = DisorientedTargetsLevel.ContainsKey(target) ? DisorientedTargetsLevel[target] : 0;
             break;
         case DrCategory.Stun:
             level = StunnedTargetsLevel.ContainsKey(target) ? StunnedTargetsLevel[target] : 0;
             break;
         case DrCategory.Root:
             level = RootedTargetsLevel.ContainsKey(target) ? RootedTargetsLevel[target] : 0;
             break;
         case DrCategory.Incapacitate:
             level = IncapacitatedTargetsLevel.ContainsKey(target) ? IncapacitatedTargetsLevel[target] : 0;
             break;
         case DrCategory.Silence:
             level = SilenceTargetsLevel.ContainsKey(target) ? SilenceTargetsLevel[target] : 0;
             break;
     }
     return level;
 }
コード例 #4
0
        private void AddDr(WoWUnit target, DrCategory category)
        {
            if (target == null || !target.IsValid)
            {
                return;
            }

            switch (category)
            {
            case DrCategory.Disoriented:
                if (!Instance.DisorientedTargets.ContainsKey(target))
                {
                    Instance.DisorientedTargets.Add(target, Stopwatch.StartNew());
                }
                else
                {
                    Instance.DisorientedTargets.Remove(target);
                    Instance.DisorientedTargets.Add(target, Stopwatch.StartNew());
                }

                if (!Instance.DisorientedTargetsLevel.ContainsKey(target))
                {
                    Instance.DisorientedTargetsLevel.Add(target, 1);
                }
                else
                {
                    var oldDrLevel = Instance.DisorientedTargetsLevel[target];
                    Instance.DisorientedTargetsLevel.Remove(target);
                    Instance.DisorientedTargetsLevel.Add(target, oldDrLevel + 1);
                }

                Log.Combat(String.Format("Added {0} on Desorientation DR, Level : {1}",
                                         target.SafeName,
                                         Instance.DisorientedTargetsLevel[target]));
                break;

            case DrCategory.Stun:
                if (!Instance.StunnedTargets.ContainsKey(target))
                {
                    Instance.StunnedTargets.Add(target, Stopwatch.StartNew());
                }
                else
                {
                    Instance.StunnedTargets.Remove(target);
                    Instance.StunnedTargets.Add(target, Stopwatch.StartNew());
                }
                if (!Instance.StunnedTargetsLevel.ContainsKey(target))
                {
                    Instance.StunnedTargetsLevel.Add(target, 1);
                }
                else
                {
                    var oldDrLevel = Instance.StunnedTargetsLevel[target];
                    Instance.StunnedTargetsLevel.Remove(target);
                    Instance.StunnedTargetsLevel.Add(target, oldDrLevel + 1);
                }

                Log.Combat(String.Format("Added {0} on Stun DR, Level : {1}",
                                         target.SafeName,
                                         Instance.StunnedTargetsLevel[target]));
                break;

            case DrCategory.Root:
                if (!Instance.RootedTargets.ContainsKey(target))
                {
                    Instance.RootedTargets.Add(target, Stopwatch.StartNew());
                }
                else
                {
                    Instance.RootedTargets.Remove(target);
                    Instance.RootedTargets.Add(target, Stopwatch.StartNew());
                }
                if (!Instance.RootedTargetsLevel.ContainsKey(target))
                {
                    Instance.RootedTargetsLevel.Add(target, 1);
                }
                else
                {
                    var oldDrLevel = Instance.RootedTargetsLevel[target];
                    Instance.RootedTargetsLevel.Remove(target);
                    Instance.RootedTargetsLevel.Add(target, oldDrLevel + 1);
                }

                Log.Combat(String.Format("Added {0} on Root DR, Level : {1}",
                                         target.SafeName,
                                         Instance.RootedTargetsLevel[target]));
                break;

            case DrCategory.Incapacitate:
                if (!Instance.IncapacitatedTargets.ContainsKey(target))
                {
                    Instance.IncapacitatedTargets.Add(target, Stopwatch.StartNew());
                }
                else
                {
                    Instance.IncapacitatedTargets.Remove(target);
                    Instance.IncapacitatedTargets.Add(target, Stopwatch.StartNew());
                }
                if (!Instance.IncapacitatedTargetsLevel.ContainsKey(target))
                {
                    Instance.IncapacitatedTargetsLevel.Add(target, 1);
                }
                else
                {
                    var oldDrLevel = Instance.IncapacitatedTargetsLevel[target];
                    Instance.IncapacitatedTargetsLevel.Remove(target);
                    Instance.IncapacitatedTargetsLevel.Add(target, oldDrLevel + 1);
                }

                Log.Combat(String.Format("Added {0} on Incapacitate DR, Level : {1}",
                                         target.SafeName,
                                         Instance.IncapacitatedTargetsLevel[target]));
                break;

            case DrCategory.Silence:
                if (!Instance.SilenceTargets.ContainsKey(target))
                {
                    Instance.SilenceTargets.Add(target, Stopwatch.StartNew());
                }
                else
                {
                    Instance.SilenceTargets.Remove(target);
                    Instance.SilenceTargets.Add(target, Stopwatch.StartNew());
                }
                if (!Instance.SilenceTargetsLevel.ContainsKey(target))
                {
                    Instance.SilenceTargetsLevel.Add(target, 1);
                }
                else
                {
                    var oldDrLevel = Instance.SilenceTargetsLevel[target];
                    Instance.SilenceTargetsLevel.Remove(target);
                    Instance.SilenceTargetsLevel.Add(target, oldDrLevel + 1);
                }

                Log.Combat(String.Format("Added {0} on Silence DR, Level : {1}",
                                         target.SafeName,
                                         Instance.SilenceTargetsLevel[target]));
                break;
            }
        }