internal TeraData(BasicTeraData basicData, string region) { Region = basicData.Regions.Single(x => x.Key == region); SkillDatabase = new SkillDatabase(Path.Combine(basicData.ResourceDirectory, "user_skills.txt")); NpcDatabase = new NpcDatabase(Path.Combine(basicData.ResourceDirectory, "npc.txt")); OpCodeNamer = new OpCodeNamer(Path.Combine(basicData.ResourceDirectory, string.Format("opcodes-{0}.txt", Region.Version))); }
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; Debug.Assert(!message.IsUseless); Source = entityRegistry.GetOrPlaceholder(message.Source); Target = entityRegistry.GetOrPlaceholder(message.Target); var sourceUser = UserEntity.ForEntity(Source); // 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); SourcePlayer = playerTracker.Get(sourceUser.PlayerId); } if (targetUser != null) { TargetPlayer = playerTracker.Get(targetUser.PlayerId); } }
internal TeraData(BasicTeraData basicData, string region, bool detectBosses) { string suffix = (basicData.Language=="Auto")?(region != "EU") ? region : "EU-EN": basicData.Language; SkillDatabase = new SkillDatabase(basicData.ResourceDirectory,suffix); HotDotDatabase = new HotDotDatabase(basicData.ResourceDirectory, suffix); NpcDatabase = new NpcDatabase(basicData.ResourceDirectory, suffix, detectBosses); //OpCodeNamer = new OpCodeNamer(Path.Combine(basicData.ResourceDirectory, $"opcodes\\opcodes-{region}.txt")); }
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); }
internal TeraData(BasicTeraData basicData, string region) { Region = basicData.Regions.Single(x => x.Key == region); SkillDatabase = new SkillDatabase(basicData.ResourceDirectory); OpCodeNamer = new OpCodeNamer(Path.Combine(basicData.ResourceDirectory, $"opcodes-{Region.Version}.txt")); }
internal TeraData(BasicTeraData basicData, string region) { SkillDatabase = new SkillDatabase(basicData.ResourceDirectory); OpCodeNamer = new OpCodeNamer(Path.Combine(basicData.ResourceDirectory, $"opcodes-{region}.txt")); }