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 MessageFactory() { _opCodeNamer = new OpCodeNamer(new Dictionary <ushort, string> { { 19900, "C_CHECK_VERSION" } }); Version = 0; Region = "Unknown"; }
public TeraMessageReader(Message message, OpCodeNamer opCodeNamer, uint version, OpCodeNamer sysMsgNamer) : base(GetStream(message), Encoding.Unicode) { Message = message; OpCodeName = opCodeNamer.GetName(message.OpCode); SysMsgNamer = sysMsgNamer; Version = version; }
public TeraMessageReader(Message message, OpCodeNamer opCodeNamer, MessageFactory factory, OpCodeNamer sysMsgNamer) : base(GetStream(message), Encoding.Unicode) { Message = message; OpCodeName = opCodeNamer.GetName(message.OpCode); SysMsgNamer = sysMsgNamer; Factory = factory; }
public MessageFactory(OpCodeNamer opCodeNamer) { _opCodeNamer = opCodeNamer; foreach (var name in OpcodeNameToType.Keys) { opCodeNamer.GetCode(name); } }
public MessageFactory(OpCodeNamer opCodeNamer, string region, uint version, bool chatEnabled = false, OpCodeNamer sysMsgNamer = null) { _opCodeNamer = opCodeNamer; _sysMsgNamer = sysMsgNamer; OpcodeNameToType.Clear(); CoreServices.ToList().ForEach(x => OpcodeNameToType[_opCodeNamer.GetCode(x.Key)] = x.Value); if (chatEnabled) { ChatServices.ToList().ForEach(x => OpcodeNameToType[_opCodeNamer.GetCode(x.Key)] = x.Value); } Version = version; Region = region; _chatEnabled = chatEnabled; }
internal C_CHECK_VERSION(Tera.Game.Messages.C_CHECK_VERSION message) { Debug.WriteLine("VERSION0 = " + message.Versions[0]); // Debug.WriteLine("VERSION1 = " + message.Versions[1]); var opCodeNamer = new OpCodeNamer(Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/{message.Versions[0]}.txt")); OpCodeNamer sysMsgNamer=null; try //we we can have working opcodes from older KR versions included, but don't have sysmsg codes for them, todo: delete trycatch when we have all files for all upcoming versions. {sysMsgNamer = new OpCodeNamer(Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/smt_{message.Versions[0]}.txt"));} catch{} NetworkController.Instance.MessageFactory = new MessageFactory(opCodeNamer, NetworkController.Instance.Server.Region, false, sysMsgNamer); if (TeraSniffer.Instance.ClientProxyOverhead + TeraSniffer.Instance.ServerProxyOverhead > 0x1000) BasicTeraData.LogError("Client Proxy overhead: " + TeraSniffer.Instance.ClientProxyOverhead + "\r\nServer Proxy overhead: " + TeraSniffer.Instance.ServerProxyOverhead); }
public TeraMessageReader(Message message, OpCodeNamer opCodeNamer) : base(GetStream(message), Encoding.Unicode) { Message = message; OpCodeName = opCodeNamer.GetName(message.OpCode); }
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; } }
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")); }