internal static void HandleFriendIntoArea(S_NOTIFY_TO_FRIENDS_WALK_INTO_SAME_AREA x) { var friend = ChatWindowManager.Instance.Friends.FirstOrDefault(f => f.PlayerId == x.PlayerId); if (friend == null) { return; } const string opcode = "SMT_FRIEND_WALK_INTO_SAME_AREA"; var areaName = x.SectionId.ToString(); try { areaName = SessionManager.MapDatabase.Names[SessionManager.MapDatabase.Worlds[x.WorldId].Guards[x.GuardId].Sections[x.SectionId].NameId]; } catch (Exception) { // ignored } var srvMsg = "@0\vUserName\v" + friend.Name + "\vAreaName\v" + areaName; SessionManager.SystemMessagesDatabase.Messages.TryGetValue(opcode, out var m); SystemMessagesProcessor.AnalyzeMessage(srvMsg, m, opcode); }
public static void HandleGuardianOnEnter(S_FIELD_EVENT_ON_ENTER obj) { const string opcode = "SMT_FIELD_EVENT_ENTER"; SessionManager.SystemMessagesDatabase.Messages.TryGetValue(opcode, out var m); SystemMessagesProcessor.AnalyzeMessage("", m, opcode); }
internal static void HandleFriendStatus(S_UPDATE_FRIEND_INFO x) { var opcodeName = "SMT_FRIEND_IS_CONNECTED"; if (!x.Online) return; if (SessionManager.SystemMessagesDatabase.Messages.TryGetValue(opcodeName, out var m)) { SystemMessagesProcessor.AnalyzeMessage(x.Name, m, opcodeName); } }
public static void HandleSystemMessage(S_SYSTEM_MESSAGE x) { try { var msg = x.Message.Split('\v'); var opcode = ushort.Parse(msg[0].Substring(1)); var opcodeName = SystemMessageNamer.GetName(opcode); if (SessionManager.SystemMessagesDatabase.Messages.TryGetValue(opcodeName, out var m)) { SystemMessagesProcessor.AnalyzeMessage(x.Message, m, opcodeName); } } catch (Exception) { File.AppendAllText("chat-errors.log", x.Message + "\n"); } }
public static void HandleNotifyGuildQuestUrgent(S_NOTIFY_GUILD_QUEST_URGENT obj) { const string opcode = "SMT_GQUEST_URGENT_NOTIFY"; SessionManager.SystemMessagesDatabase.Messages.TryGetValue(opcode, out var m); switch (obj.Type) { case S_NOTIFY_GUILD_QUEST_URGENT.GuildBamQuestType.Announce: var questName = obj.QuestId == 0 ? "Defeat Guild BAM" : SessionManager.GuildQuestDatabase.GuildQuests[obj.QuestId].Title; SessionManager.MonsterDatabase.TryGetMonster(obj.TemplateId, obj.ZoneId, out var npc); var zone = SessionManager.MapDatabase.Names[obj.ZoneId]; var msg = $"@0\vquestName\v{questName}\vnpcName\v{npc.Name}\vzoneName\v{zone}"; SystemMessagesProcessor.AnalyzeMessage(msg, m, opcode); break; default: return; } }
public static void HandleChangeGuildChief(S_CHANGE_GUILD_CHIEF obj) { const string opcode = "SMT_GC_SYSMSG_GUILD_CHIEF_CHANGED"; SessionManager.SystemMessagesDatabase.Messages.TryGetValue(opcode, out var m); SystemMessagesProcessor.AnalyzeMessage($"@0\vName\v{SessionManager.GetGuildMemberName(obj.PlayerId)}", m, opcode); }