public void Update(EachSkillResultServerMessage message) { var skillResult = new SkillResult(message, _entityTracker, _playerTracker, _skillDatabase); if (skillResult.SourcePlayer != null) { var playerStats = GetOrCreate(skillResult.SourcePlayer); var statsChange = StatsChange(skillResult); playerStats.Dealt.Add(statsChange); TotalDealt.Add(statsChange); } if (skillResult.TargetPlayer != null) { var playerStats = GetOrCreate(skillResult.TargetPlayer); var statsChange = StatsChange(skillResult); playerStats.Received.Add(statsChange); TotalReceived.Add(statsChange); } if (skillResult.SourcePlayer != null && (skillResult.Damage > 0) && (skillResult.Source.Id != skillResult.Target.Id)) { LastAttack = skillResult.Time; if (FirstAttack == null) { FirstAttack = skillResult.Time; } } }
public SkillResult(EachSkillResultServerMessage message, EntityTracker entityRegistry, PlayerTracker playerTracker, SkillDatabase skillDatabase) { Time = message.Time; Amount = message.Amount; IsCritical = message.IsCritical; IsHeal = message.IsHeal; SkillId = message.SkillId; Source = entityRegistry.GetOrPlaceholder(message.Source); Target = entityRegistry.GetOrPlaceholder(message.Target); var userNpc = UserEntity.ForEntity(Source); var npc = (NpcEntity)userNpc["source"]; var sourceUser = userNpc["root_source"] as UserEntity; // Attribute damage dealt by owned entities to the owner var targetUser = Target as UserEntity; // But don't attribute damage received by owned entities to the owner if (sourceUser != null) { Skill = skillDatabase.Get(sourceUser, message); if (Skill == null && npc != null) { Skill = new UserSkill(message.SkillId, sourceUser.RaceGenderClass, npc.Info.Name); } SourcePlayer = playerTracker.Get(sourceUser.PlayerId); if (Skill == null) { Skill = new UserSkill(message.SkillId, sourceUser.RaceGenderClass, "Unknown"); } } if (targetUser != null) { TargetPlayer = playerTracker.Get(targetUser.PlayerId); } }
internal S_EACH_SKILL_RESULT(EachSkillResultServerMessage message) { NetworkController.Instance.EntityTracker.Update(message); var skillResult = new SkillResult(message, NetworkController.Instance.EntityTracker, NetworkController.Instance.PlayerTracker, BasicTeraData.Instance.SkillDatabase, BasicTeraData.Instance.PetSkillDatabase, NetworkController.Instance.AbnormalityTracker); DamageTracker.Instance.Update(skillResult); NotifyProcessor.Instance.UpdateMeterBoss(message); }
internal void UpdateMeterBoss(EachSkillResultServerMessage message) { var source = PacketProcessor.Instance.EntityTracker.GetOrNull(message.Source) as UserEntity; if (PacketProcessor.Instance.EntityTracker.MeterUser != source) { return; } UpdateMeterBoss(message.Target); }
private void UpdateStats(Stats stats, EachSkillResultServerMessage message) { stats.Damage += message.Damage; stats.Heal += message.Heal; stats.Hits++; if (message.IsCritical) { stats.Crits++; } }
public void Update(EachSkillResultServerMessage message) { var skillResult = new SkillResult(message, _entityTracker, _playerTracker, _skillDatabase); if (skillResult.SourcePlayer != null) { var playerStats = GetOrCreate(skillResult.SourcePlayer); UpdateStats(playerStats.Dealt, skillResult); } if (skillResult.TargetPlayer != null) { var playerStats = GetOrCreate(skillResult.TargetPlayer); UpdateStats(playerStats.Received, skillResult); } }
public void Update(EachSkillResultServerMessage message) { var source = _entityRegistry.Get(message.Source) as User; if (source != null) { var playerStats = GetOrCreate(source); UpdateStats(playerStats.Dealt, message); } var target = _entityRegistry.Get(message.Target) as User; if (target != null) { var playerStats = GetOrCreate(target); UpdateStats(playerStats.Received, message); } }
internal void UpdateMeterBoss(EachSkillResultServerMessage message) { var source = NetworkController.Instance.EntityTracker.GetOrNull(message.Source) as UserEntity; if (NetworkController.Instance.EntityTracker.MeterUser != source) { return; } var target = NetworkController.Instance.EntityTracker.GetOrNull(message.Target) as NpcEntity; if (target == null) { return; } if (target.Info.Boss) { _lastBossMeterUser = target.Id; } }
// skillIds are reused across races and class, so we need a RaceGenderClass to disambiguate them public Skill Get(UserEntity user, EachSkillResultServerMessage message) { var skillId = message.SkillId; //check if we have an override first var overrideCollection = message.IsHeal ? _healSkillIdOverrides : _damageSkillIdOverrides; if (overrideCollection.ContainsKey(user.RaceGenderClass.Class)) { //check class specific overrides var skill = overrideCollection[user.RaceGenderClass.Class].FirstOrDefault(s => s.Id == skillId); //check common overrides if (skill == null && overrideCollection.ContainsKey(PlayerClass.Common)) { skill = overrideCollection[PlayerClass.Common].FirstOrDefault(s => s.Id == skillId); } if (skill != null) { return(skill); } } var raceGenderClass = user.RaceGenderClass; var comparer = new Helpers.ProjectingEqualityComparer <Skill, int>(x => x.Id); foreach (var rgc2 in raceGenderClass.Fallbacks()) { if (!_userSkilldata.ContainsKey(rgc2)) { continue; } UserSkill skill; if (!_userSkilldata[rgc2].TryGetValue(skillId, out skill)) { continue; } return(skill); } return(null); }
public void Update(EachSkillResultServerMessage m) { var entity = GetOrNull(m.Target); if (entity == null) { return; } if (m.Position.X == 0 && m.Position.Y == 0 && m.Position.Z == 0) { return; } entity.Position = m.Position; entity.Finish = m.Position; entity.Speed = 0; entity.StartTime = 0; entity.Heading = m.Heading; entity.EndAngle = m.Heading; entity.EndTime = 0; }
public SkillResult(EachSkillResultServerMessage message, EntityTracker entityRegistry, PlayerTracker playerTracker, SkillDatabase skillDatabase) { Time = message.Time; Amount = message.Amount; IsCritical = message.IsCritical; IsHeal = message.IsHeal; SkillId = message.SkillId; Source = entityRegistry.GetOrPlaceholder(message.Source); Target = entityRegistry.GetOrPlaceholder(message.Target); var sourceUser = Source.RootOwner as UserEntity; // Attribute damage dealt by owned entities to the owner var targetUser = Target as UserEntity; // But don't attribute damage received by owned entities to the owner if (sourceUser != null) { Skill = skillDatabase.GetOrNull(sourceUser, message.SkillId); SourcePlayer = playerTracker.Get(sourceUser.ServerId, sourceUser.PlayerId); } if (targetUser != null) { TargetPlayer = playerTracker.Get(targetUser.ServerId, targetUser.PlayerId); } }
public SkillResult(EachSkillResultServerMessage message, EntityTracker entityRegistry, PlayerTracker playerTracker, SkillDatabase skillDatabase, PetSkillDatabase petSkillDatabase = null, AbnormalityTracker abnormalityTracker = null) { Time = message.Time; Amount = message.Amount; IsCritical = message.IsCritical; IsHp = message.IsHp; IsHeal = message.IsHeal; SkillId = message.SkillId; Abnormality = false; Source = entityRegistry.GetOrPlaceholder(message.Source); Target = entityRegistry.GetOrPlaceholder(message.Target); if (Source is PlaceHolderEntity && (Target as NpcEntity)?.Info.Boss == true) { Source = playerTracker.GetUnknownPlayer() ?? Source; //track unknown damage dealt to bosses like in raid-30 } if (abnormalityTracker?.AbnormalityExist(message.Target, 950187) ?? false) { Amount = 0; //fix raid-30 bug with 1kkk damage after shield } var userNpc = UserEntity.ForEntity(Source); var npc = (NpcEntity)userNpc["source"]; var sourceUser = userNpc["root_source"] as UserEntity; // Attribute damage dealt by owned entities to the owner var targetUser = Target as UserEntity; // But don't attribute damage received by owned entities to the owner if (sourceUser != null) { Skill = skillDatabase.Get(sourceUser, message); if (Skill == null && npc != null) { Skill = petSkillDatabase?.GetOrNull(npc.Info, SkillId) ?? new UserSkill(message.SkillId, sourceUser.RaceGenderClass, npc.Info.Name, null, "", skillDatabase.GetSkillByPetName(npc.Info.Name, sourceUser.RaceGenderClass)?.IconName ?? "", npc.Info); } SourcePlayer = playerTracker.Get(sourceUser.ServerId, sourceUser.PlayerId); if (Skill == null) { Skill = new UserSkill(message.SkillId, sourceUser.RaceGenderClass, "Unknown"); } } if (targetUser != null) { TargetPlayer = playerTracker.Get(targetUser.ServerId, targetUser.PlayerId); } if (Source is PlaceHolderEntity || Target is PlaceHolderEntity) { return; //fix error on skills from or dealt to unknown entities } Source.Position = Source.Position.MoveForvard(Source.Finish, Source.Speed, message.Time.Ticks - Source.StartTime); if (Source.EndTime > 0 && Source.EndTime <= Source.StartTime) { Source.Heading = Source.EndAngle; Source.EndTime = 0; } Target.Position = Target.Position.MoveForvard(Target.Finish, Target.Speed, message.Time.Ticks - Target.StartTime); if (Target.EndTime > 0 && Target.EndTime <= Target.StartTime) { Target.Heading = Target.EndAngle; Target.EndTime = 0; } if (SourcePlayer != null && npc != null) { HitDirection = HitDirection.Pet; } else if (Source is ProjectileEntity || Source.Heading.Gradus == 0) { if (Skill?.Boom ?? true) { HitDirection = Source.Position.GetHeading(Target.Position).HitDirection(Target.Heading); } else { if ((HitDirection = userNpc["root_source"].Heading.HitDirection(Target.Heading)) != Source.Position.GetHeading(Target.Position).HitDirection(Target.Heading)) { HitDirection = HitDirection.Front; } } } else if ((HitDirection = Source.Heading.HitDirection(Target.Heading)) != Source.Position.GetHeading(Target.Position).HitDirection(Target.Heading)) { HitDirection = HitDirection.Front; } if ((SourcePlayer?.Class == PlayerClass.Archer) && (abnormalityTracker?.AbnormalityExist(sourceUser.Id, 601600) ?? false)) { HitDirection = HitDirection.Back; } //Debug.WriteLine(HitDirection); HitDirection = HitDirection & ~(HitDirection.Left | HitDirection.Right); }
public Skill Get(UserEntity user, EachSkillResultServerMessage message) { return(GetOrNull(user.RaceGenderClass, message.SkillId)); }
public static bool IsValid(this EachSkillResultServerMessage message, DamageTracker tracker = null) { return(message != null && !message.IsUseless && //stuff like warrior DFA (tracker?.FirstAttack != null || (!message.IsHeal && message.Amount > 0)) && //only record first hit is it's a damage hit (heals occurring outside of fights) !(message.Target.Equals(message.Source) && !message.IsHeal && message.Amount > 0)); //disregard damage dealt to self (gunner self destruct) }