Exemple #1
0
		void standardTracker_CombatEvent(CombatEventArgs obj)
		{
			//Debug.WriteToChat("Combat: SourceName: " + obj.SourceName + ", TargetName: " + obj.TargetName + ", AttackType: " + obj.AttackType + ", DamageElemenet: " + obj.DamageElemenet + ", IsKillingBlow: " + obj.IsKillingBlow + ", IsCriticalHit: " + obj.IsCriticalHit + ", IsFailedAttack: " + obj.IsFailedAttack + ", DamageAmount: " + obj.DamageAmount);

			// We only track events that interact with us
			if (obj.SourceName != CoreManager.Current.CharacterFilter.Name && obj.TargetName != CoreManager.Current.CharacterFilter.Name)
				return;

			CombatInfo combatInfo = combatInfos.Find(i => i.SourceName == obj.SourceName && i.TargetName == obj.TargetName);

			if (combatInfo == null)
			{
				combatInfo = new CombatInfo(obj.SourceName, obj.TargetName);

				combatInfos.Add(combatInfo);
			}

			combatInfo.AddFromCombatEventArgs(obj);

			if (CombatInfoUpdated != null)
				CombatInfoUpdated(combatInfo);
		}
Exemple #2
0
		public void AddFromCombatEventArgs(CombatEventArgs combatEventArgs)
		{
			if (combatEventArgs.IsKillingBlow)
				KillingBlows++;

			if (!DamageByAttackTypes.ContainsKey(combatEventArgs.AttackType))
				DamageByAttackTypes.Add(combatEventArgs.AttackType, new DamageByAttackType());

			DamageByAttackType damageByAttackType = DamageByAttackTypes[combatEventArgs.AttackType];

			if (!damageByAttackType.DamageByElements.ContainsKey(combatEventArgs.DamageElemenet))
				damageByAttackType.DamageByElements.Add(combatEventArgs.DamageElemenet, new DamageByAttackType.DamageByElement());

			DamageByAttackType.DamageByElement damageByElement = damageByAttackType.DamageByElements[combatEventArgs.DamageElemenet];

			damageByElement.TotalAttacks++;

			if (combatEventArgs.IsFailedAttack)
				damageByElement.FailedAttacks++;

			if (combatEventArgs.IsCriticalHit)
				damageByElement.Crits++;

			if (!combatEventArgs.IsCriticalHit)
			{
				damageByElement.TotalNormalDamage += combatEventArgs.DamageAmount;

				if (combatEventArgs.DamageAmount > damageByElement.MaxNormalDamage)
					damageByElement.MaxNormalDamage = combatEventArgs.DamageAmount;
			}
			else
			{
				damageByElement.TotalCritDamage += combatEventArgs.DamageAmount;

				if (combatEventArgs.DamageAmount > damageByElement.MaxCritDamage)
					damageByElement.MaxCritDamage = combatEventArgs.DamageAmount;
			}
		}
Exemple #3
0
        void Current_ChatBoxMessage(object sender, ChatTextInterceptEventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(e.Text))
                {
                    return;
                }

                if (Util.IsChat(e.Text))
                {
                    return;
                }

                string sourceName = String.Empty;
                string targetName = String.Empty;

                AttackType    attackType     = AttackType.Unknown;
                DamageElement damageElemenet = DamageElement.Unknown;

                bool isFailedAttack = false;
                bool isCriticalHit  = e.Text.Contains("Critical hit!");
                bool isOverpower    = e.Text.Contains("Overpower!");
                bool isSneakAttack  = e.Text.Contains("Sneak Attack!");
                bool isRecklessness = e.Text.Contains("Recklessness!");
                bool isKillingBlow  = false;

                int damageAmount = 0;

                // You evaded Remoran Corsair!
                // Ruschk S****t evaded your attack.
                // You resist the spell cast by Remoran Corsair
                // Sentient Crystal Shard resists your spell
                if (CombatMessages.IsFailedAttack(e.Text))
                {
                    isFailedAttack = true;

                    string parsedName = string.Empty;

                    foreach (Regex regex in CombatMessages.FailedAttacks)
                    {
                        Match match = regex.Match(e.Text);

                        if (match.Success)
                        {
                            parsedName = match.Groups["targetname"].Value;
                            break;
                        }
                    }

                    if (e.Text.StartsWith("You evaded "))
                    {
                        sourceName = parsedName;
                        targetName = CoreManager.Current.CharacterFilter.Name;
                        attackType = AttackType.MeleeMissle;
                    }
                    else if (e.Text.Contains(" evaded your attack"))
                    {
                        sourceName = CoreManager.Current.CharacterFilter.Name;
                        targetName = parsedName;
                        attackType = AttackType.MeleeMissle;
                    }
                    else if (e.Text.StartsWith("You resist the spell cast by "))
                    {
                        sourceName = parsedName;
                        targetName = CoreManager.Current.CharacterFilter.Name;
                        attackType = AttackType.Magic;
                    }
                    else if (e.Text.Contains(" resists your spell"))
                    {
                        sourceName = CoreManager.Current.CharacterFilter.Name;
                        targetName = parsedName;
                        attackType = AttackType.Magic;
                    }
                }
                // You flatten Noble Remains's body with the force of your assault!
                // Your killing blow nearly turns Shivering Crystalline Wisp inside-out!
                // The thunder of crushing Pyre Minion is followed by the deafening silence of death!
                // Old Bones is shattered by your assault!
                else if (CombatMessages.IsKilledByMeMessage(e.Text))
                {
                    isKillingBlow = true;

                    sourceName = CoreManager.Current.CharacterFilter.Name;

                    foreach (Regex regex in CombatMessages.TargetKilledByMe)
                    {
                        Match match = regex.Match(e.Text);

                        if (match.Success)
                        {
                            targetName = match.Groups["targetname"].Value;

                            break;
                        }
                    }
                }
                else
                {
                    foreach (Regex regex in CombatMessages.MeleeMissileReceivedAttacks)
                    {
                        Match match = regex.Match(e.Text);

                        if (match.Success)
                        {
                            sourceName     = match.Groups["targetname"].Value;
                            targetName     = CoreManager.Current.CharacterFilter.Name;
                            attackType     = AttackType.MeleeMissle;
                            damageElemenet = GetElementFromText(e.Text);
                            int.TryParse(match.Groups["points"].Value, out damageAmount);
                            goto Found;
                        }
                    }

                    foreach (Regex regex in CombatMessages.MeleeMissileGivenAttacks)
                    {
                        Match match = regex.Match(e.Text);

                        if (match.Success)
                        {
                            sourceName     = CoreManager.Current.CharacterFilter.Name;
                            targetName     = match.Groups["targetname"].Value;
                            attackType     = AttackType.MeleeMissle;
                            damageElemenet = GetElementFromText(e.Text);
                            int.TryParse(match.Groups["points"].Value, out damageAmount);
                            goto Found;
                        }
                    }

                    foreach (Regex regex in CombatMessages.MagicReceivedAttacks)
                    {
                        Match match = regex.Match(e.Text);

                        if (match.Success)
                        {
                            sourceName     = match.Groups["targetname"].Value;
                            targetName     = CoreManager.Current.CharacterFilter.Name;
                            attackType     = AttackType.Magic;
                            damageElemenet = GetElementFromText(e.Text);
                            int.TryParse(match.Groups["points"].Value, out damageAmount);
                            goto Found;
                        }
                    }

                    foreach (Regex regex in CombatMessages.MagicGivenAttacks)
                    {
                        Match match = regex.Match(e.Text);

                        if (match.Success)
                        {
                            sourceName     = CoreManager.Current.CharacterFilter.Name;
                            targetName     = match.Groups["targetname"].Value;
                            attackType     = AttackType.Magic;
                            damageElemenet = GetElementFromText(e.Text);
                            int.TryParse(match.Groups["points"].Value, out damageAmount);
                            goto Found;
                        }
                    }

                    foreach (Regex regex in CombatMessages.MagicCastAttacks)
                    {
                        Match match = regex.Match(e.Text);

                        if (match.Success)
                        {
                            sourceName     = CoreManager.Current.CharacterFilter.Name;
                            targetName     = match.Groups["targetname"].Value;
                            attackType     = AttackType.Magic;
                            damageElemenet = DamageElement.None;
                            goto Found;
                        }
                    }

                    Found :;
                }

                if (sourceName == String.Empty && targetName == String.Empty)
                {
                    return;
                }

                if (!isKillingBlow && attackType == AttackType.Unknown)
                {
                    Debug.WriteToChat("Unable to parse attack type from: " + e.Text);
                }

                if (!isKillingBlow && !isFailedAttack && damageElemenet == DamageElement.Unknown)
                {
                    Debug.WriteToChat("Unable to parse damage element from: " + e.Text);
                }

                CombatEventArgs combatEventArgs = new CombatEventArgs(sourceName, targetName, attackType, damageElemenet, isFailedAttack, isCriticalHit, isOverpower, isSneakAttack, isRecklessness, isKillingBlow, damageAmount);

                if (CombatEvent != null)
                {
                    CombatEvent(combatEventArgs);
                }
            }
            catch (Exception ex) { Debug.LogException(ex, e.Text); }
        }
		void Current_ChatBoxMessage(object sender, ChatTextInterceptEventArgs e)
		{
			try
			{
				if (String.IsNullOrEmpty(e.Text))
					return;

				if (Util.IsChat(e.Text))
					return;

				string sourceName = String.Empty;
				string targetName = String.Empty;

				AttackType attackType = AttackType.Unknown;
				DamageElement damageElemenet = DamageElement.Unknown;

				bool isFailedAttack = false;
				bool isCriticalHit = e.Text.Contains("Critical hit!");
				bool isOverpower = e.Text.Contains("Overpower!");
				bool isKillingBlow = false;

				int damageAmount = 0;

				// You evaded Remoran Corsair!
				// Ruschk S****t evaded your attack.
				// You resist the spell cast by Remoran Corsair
				// Sentient Crystal Shard resists your spell
				if (CombatMessages.IsFailedAttack(e.Text))
				{
					isFailedAttack = true;

					string parsedName = string.Empty;

					foreach (Regex regex in CombatMessages.FailedAttacks)
					{
						Match match = regex.Match(e.Text);

						if (match.Success)
						{
							parsedName = match.Groups["targetname"].Value;
							break;
						}
					}

					if (e.Text.StartsWith("You evaded "))
					{
						sourceName = parsedName;
						targetName = CoreManager.Current.CharacterFilter.Name;
						attackType = AttackType.MeleeMissle;
					}
					else if (e.Text.Contains(" evaded your attack"))
					{
						sourceName = CoreManager.Current.CharacterFilter.Name;
						targetName = parsedName;
						attackType = AttackType.MeleeMissle;
					}
					else if (e.Text.StartsWith("You resist the spell cast by "))
					{
						sourceName = parsedName;
						targetName = CoreManager.Current.CharacterFilter.Name;
						attackType = AttackType.Magic;
					}
					else if (e.Text.Contains(" resists your spell"))
					{
						sourceName = CoreManager.Current.CharacterFilter.Name;
						targetName = parsedName;
						attackType = AttackType.Magic;
					}
				}
				// You flatten Noble Remains's body with the force of your assault!
				// Your killing blow nearly turns Shivering Crystalline Wisp inside-out!
				// The thunder of crushing Pyre Minion is followed by the deafening silence of death!
				// Old Bones is shattered by your assault!
				else if (CombatMessages.IsKilledByMeMessage(e.Text))
				{
					isKillingBlow = true;

					sourceName = CoreManager.Current.CharacterFilter.Name;

					foreach (Regex regex in CombatMessages.TargetKilledByMe)
					{
						Match match = regex.Match(e.Text);

						if (match.Success)
						{
							targetName = match.Groups["targetname"].Value;

							break;
						}
					}
				}
				else
				{
					foreach (Regex regex in CombatMessages.MeleeMissileReceivedAttacks)
					{
						Match match = regex.Match(e.Text);

						if (match.Success)
						{
							sourceName = match.Groups["targetname"].Value;
							targetName = CoreManager.Current.CharacterFilter.Name;
							attackType = AttackType.MeleeMissle;
							damageElemenet = GetElementFromText(e.Text);
							int.TryParse(match.Groups["points"].Value, out damageAmount);
							goto Found;
						}
					}

					foreach (Regex regex in CombatMessages.MeleeMissileGivenAttacks)
					{
						Match match = regex.Match(e.Text);

						if (match.Success)
						{
							sourceName = CoreManager.Current.CharacterFilter.Name;
							targetName = match.Groups["targetname"].Value;
							attackType = AttackType.MeleeMissle;
							damageElemenet = GetElementFromText(e.Text);
							int.TryParse(match.Groups["points"].Value, out damageAmount);
							goto Found;
						}
					}

					foreach (Regex regex in CombatMessages.MagicReceivedAttacks)
					{
						Match match = regex.Match(e.Text);

						if (match.Success)
						{
							sourceName = match.Groups["targetname"].Value;
							targetName = CoreManager.Current.CharacterFilter.Name;
							attackType = AttackType.Magic;
							damageElemenet = GetElementFromText(e.Text);
							int.TryParse(match.Groups["points"].Value, out damageAmount);
							goto Found;
						}
					}

					foreach (Regex regex in CombatMessages.MagicGivenAttacks)
					{
						Match match = regex.Match(e.Text);

						if (match.Success)
						{
							sourceName = CoreManager.Current.CharacterFilter.Name;
							targetName = match.Groups["targetname"].Value;
							attackType = AttackType.Magic;
							damageElemenet = GetElementFromText(e.Text);
							int.TryParse(match.Groups["points"].Value, out damageAmount);
							goto Found;
						}
					}

					foreach (Regex regex in CombatMessages.MagicCastAttacks)
					{
						Match match = regex.Match(e.Text);

						if (match.Success)
						{
							sourceName = CoreManager.Current.CharacterFilter.Name;
							targetName = match.Groups["targetname"].Value;
							attackType = AttackType.Magic;
							damageElemenet = DamageElement.None;
							goto Found;
						}
					}

					Found: ;
				}

				if (sourceName == String.Empty && targetName == String.Empty)
					return;

				if (!isKillingBlow && attackType == AttackType.Unknown)
					Debug.WriteToChat("Unable to parse attack type from: " + e.Text);

				if (!isKillingBlow && !isFailedAttack && damageElemenet == DamageElement.Unknown)
					Debug.WriteToChat("Unable to parse damage element from: " + e.Text);

				CombatEventArgs combatEventArgs = new CombatEventArgs(sourceName, targetName, attackType, damageElemenet, isFailedAttack, isCriticalHit, isOverpower, isKillingBlow, damageAmount);

				if (CombatEvent != null)
					CombatEvent(combatEventArgs);
			}
			catch (Exception ex) { Debug.LogException(ex, e.Text); }
		}