private void HandleNewConnection(Server server) { Text = string.Format("Damage Meter connected to {0}", server.Name); _server = server; _teraData = _basicTeraData.DataForRegion(server.Region); _entityTracker = new EntityTracker(_teraData.NpcDatabase); _playerTracker = new PlayerTracker(_entityTracker); _damageTracker = new DamageTracker(); _messageFactory = new MessageFactory(_teraData.OpCodeNamer); Logger.Log(Text); }
private void HandleNewConnection(Server server) { Server = server; _teraData = BasicTeraData.DataForRegion(server.Region); _entityTracker = new EntityTracker(); _playerTracker = new PlayerTracker(_entityTracker); _messageFactory = new MessageFactory(_teraData.OpCodeNamer); Reset(null); DamageTracker = DamageTracker ?? new DamageTracker(); Logger.Info($"Connected to server {server.Name}."); }
private void HandleNewConnection(Server server) { Server = server; _messageFactory = new MessageFactory(); ResetDamageTracker(); DamageTracker = DamageTracker ?? new DamageTracker { OnlyBosses = OnlyBosses, IgnoreOneshots = IgnoreOneshots }; _needInit = true; Logger.Info($"Connected to server {server.Name}."); }
private void HandleMessageReceived(Message obj) { var message = _messageFactory.Create(obj); if (DamageTracker.IsArchived) { var npcOccupier = message as SNpcOccupierInfo; if (npcOccupier != null) { Entity ent = _entityTracker.GetOrPlaceholder(npcOccupier.NPC); if (ent is NpcEntity) { var npce = ent as NpcEntity; if (npce.Info.Boss && npcOccupier.Target != EntityId.Empty) { CasualMessenger.Instance.ResetPlayerStats(true); //Stop viewing saved encounter on boss aggro } } return; } } _entityTracker?.Update(message); var skillResultMessage = message as EachSkillResultServerMessage; if (skillResultMessage != null) { if (skillResultMessage.IsValid(DamageTracker)) { var skillResult = new SkillResult(skillResultMessage, _entityTracker, _playerTracker, _teraData.SkillDatabase, null, _abnormalityTracker); CheckUpdate(skillResult); } return; } _playerTracker?.UpdateParty(message); _abnormalityTracker?.Update(message); var despawnNpc = message as SDespawnNpc; if (despawnNpc != null) { Entity ent = _entityTracker.GetOrPlaceholder(despawnNpc.Npc); if (ent is NpcEntity) { var npce = ent as NpcEntity; if (npce.Info.Boss && despawnNpc.Dead && !DamageTracker.IsArchived) { //no need to do something if we didn't count any skill against this boss if (DamageTracker.StatsByUser.SelectMany(x => x.SkillLog).Any(x => x.Target == npce)) { DamageTracker.PrimaryTarget = npce; //Name encounter with the last dead boss DamageTracker.IsPrimaryTargetDead = despawnNpc.Dead; //determine type ExportType exportType = ExportType.None; if (SettingsHelper.Instance.Settings.ExcelExport) exportType = exportType | ExportType.Excel; if (SettingsHelper.Instance.Settings.SiteExport) exportType = exportType | ExportType.Upload; if (exportType != ExportType.None) DataExporter.ToTeraDpsApi(exportType, DamageTracker, _teraData); if (AutosaveEncounters) ResetDamageTracker(new ResetPlayerStatsMessage { ShouldSaveCurrent = true }); } } } return; } var sLogin = message as LoginServerMessage; if (sLogin != null) { if (_needInit) { Server = BasicTeraData.Servers.GetServer(sLogin.ServerId, Server); _messageFactory.Version = Server.Region; Logger.Info($"Logged in to server {Server.Name}."); _teraData = BasicTeraData.DataForRegion(Server.Region); _entityTracker = new EntityTracker(_teraData.NpcDatabase); _playerTracker = new PlayerTracker(_entityTracker, BasicTeraData.Servers); _abnormalityTracker = new AbnormalityTracker(_entityTracker, _playerTracker, _teraData.HotDotDatabase, _abnormalityStorage, CheckUpdate); _entityTracker.Update(message); _needInit = false; } _abnormalityStorage.EndAll(message.Time.Ticks); _abnormalityTracker = new AbnormalityTracker(_entityTracker, _playerTracker, _teraData.HotDotDatabase, _abnormalityStorage, CheckUpdate); return; } var cVersion = message as C_CHECK_VERSION; if (cVersion != null) { var opCodeNamer = new OpCodeNamer(Path.Combine(BasicTeraData.ResourceDirectory, $"opcodes/{cVersion.Versions[0]}.txt")); _messageFactory = new MessageFactory(opCodeNamer, Server.Region); return; } }
protected virtual void HandleNewConnection(Server server) { Server = server; MessageFactory = new MessageFactory(); NeedInit = true; Connected?.Invoke(server.Name); }
private void HandleNewConnection(Server server) { Text = $"Damage Meter connected to {server.Name}"; _server = server; _teraData = BasicTeraData.DataForRegion(server.Region); _entityRegistry = new EntityTracker(); _playerTracker = new PlayerTracker(_entityRegistry); _damageTracker = new DamageTracker(_entityRegistry, _playerTracker, _teraData.SkillDatabase); _messageFactory = new MessageFactory(_teraData.OpCodeNamer); }