// 실제 데이터 처리 하는 곳 private void PacketWorker_OnEventReceived(string pid, GameEvents gameevent, int[] args) { var text = pid + "|" + gameevent + "|"; var pos = 0; var isfate = false; switch (gameevent) { case GameEvents.InstanceEnter: // [0] = instance code case GameEvents.InstanceLeave: { if (args.Length > 0) { text += GameData.GetInstanceName(args[0]) + "|"; pos++; } _frmOverlay.EventNone(); } break; case GameEvents.FateOccur: // [0] = fate code { var fate = GameData.GetFate(args[0]); text += fate.Name + "|" + fate.Area.Name + "|"; pos++; // 모든 페이트를 골라도 목록에 있는것만 알려줌 if (Settings.SelectedFates.Contains(args[0].ToString())) { _frmOverlay.EventFate(fate); if (_use_notify) { NotifyFate(fate); } PlayEffectSound(); } isfate = true; } break; case GameEvents.MatchQueue: // [0] = MatchType, [1] = code, [...] = instances { var type = (MatchType)args[0]; text += type + "|"; pos++; switch (type) { case MatchType.Roulette: var roulette = GameData.GetRoulette(args[1]); text += roulette.Name + "|"; pos++; _frmOverlay.EventRoulette(roulette); break; case MatchType.Assignment: text += args[1] + "|"; pos++; var p = pos; for (var i = p; i < args.Length; i++) { text += GameData.GetInstanceName(args[i]) + "|"; pos++; } _frmOverlay.EventStatus(args[1]); break; } } break; case GameEvents.MatchDone: // [0] = roulette code, [1] = instance code { var roulette = GameData.GetRoulette(args[0]); var instance = GameData.GetInstance(args[1]); text += roulette.Name + "|"; pos++; text += instance.Name + "|"; pos++; _frmOverlay.EventMatch(instance); if (_use_notify) { NotifyDuty(instance); } PlayEffectSound(); } break; case GameEvents.MatchCancel: _frmOverlay.StopBlink(); break; } for (var i = pos; i < args.Length; i++) { text += args[i] + "|"; } if (isfate) { text += args[0] + "|"; } ActGlobals.oFormActMain.ParseRawLogLine(false, DateTime.Now, "00|" + DateTime.Now.ToString("O") + "|0048|F|" + text); }
// 받은 메시지 처리기 private void PacketHandler(string pid, byte[] message) { var opcode = BitConverter.ToUInt16(message, 18); if (opcode != GamePacket.Current.OpFate && opcode != GamePacket.Current.OpDuty && opcode != GamePacket.Current.OpMatch && opcode != GamePacket.Current.OpInstance && opcode != GamePacket.Current.CriticalEngagement ) { return; } var data = message.Skip(32).ToArray(); // FATE if (opcode == GamePacket.Current.OpFate) { if (data[0] == GamePacket.Current.FateIndex) { var fcode = BitConverter.ToUInt16(data, 4); bool isselected = Settings.CurrentFate.Selected.Contains(fcode.ToString()); if (Settings.LoggingWholeFates || isselected) { var fate = GameData.GetFate(fcode); Mesg.Fate("l-fate-occured-info", fate.Name); if (isselected) { PlayEffectSound(txtSoundFate.Text); _frmOverlay.EventFate(fate); if (_use_notify) { NotifyFate(fate); } } } } } // 듀티 else if (opcode == GamePacket.Current.OpDuty) { // 안쓴다 // var status = data[0]; // var reason = data[4]; var rcode = data[GamePacket.Current.DutyRoulette]; if (rcode != 0) { // 루렛 var roulette = GameData.GetRoulette(rcode); Mesg.Duty("i-queue-roulette", roulette.Name); _frmOverlay.EventQueue(roulette.Name); } else { // 직접 골라 큐 var insts = new List <int>(); for (var i = 0; i < 5; i++) { var icode = BitConverter.ToUInt16(data, GamePacket.Current.DutyInstance + (i * 4)); if (icode == 0) { break; } } if (insts.Any()) { Mesg.Duty("i-queue-instance", string.Join(", ", insts.Select(x => GameData.GetInstance(x).Name).ToArray())); _frmOverlay.EventStatus(insts.Count); } } //임무에 들어가면 미션은 모두 해제 _missions.Clear(); } // 매치 else if (opcode == GamePacket.Current.OpMatch) { var rcode = BitConverter.ToUInt16(data, GamePacket.Current.MatchRoulette); var icode = BitConverter.ToUInt16(data, GamePacket.Current.MatchInstance); string name; if (icode == 0 && rcode != 0) { // 이것 루렛 매칭 var roulette = GameData.GetRoulette(rcode); Mesg.Duty("i-matched", roulette.Name); name = roulette.Name; } else if (icode != 0) { // 이건 골라 매칭 var instance = GameData.GetInstance(icode); Mesg.Duty("i-matched", instance.Name); name = instance.Name; } else { // 루렛도 인스도 아녀 name = Mesg.GetText("l-unknown-instance", icode); } PlayEffectSound(txtSoundFile.Text); _frmOverlay.EventMatch(name); if (_use_notify) { NotifyMatch(name); } } // 인스턴스 관련 else if (opcode == GamePacket.Current.OpInstance && GamePacket.Current.OpInstance != 0) { if (data[4] == 0) { // 0은 최초 입장때만 나오므로 이거 쓰자 var icode = BitConverter.ToUInt16(data, GamePacket.Current.InstanceInstance); var instance = GameData.GetInstance(icode); Mesg.Duty("l-instance-enter", instance.Name); _frmOverlay.EventMatch(Mesg.GetText("l-instance-enter", instance.Name)); if (_use_notify) { NotifyMatch(instance.Name); } // 미션...이 처리가되나 _missions.Clear(); } else { // 조용히 시키자 _frmOverlay.EventNone(); } } // 보즈야 서던 프론트 크리티컬 인게이지먼트 else if (opcode == GamePacket.Current.CriticalEngagement) { // 0[4] 타임스탬프 // 4[2] 남은시간 (mmss) // 6[2] ? // 8[1] 코드 // 9[1] ? // 10[1] 상태 0=끝, 1=알림/모집, 2=??, 3=진행 // 12[1] 진행 퍼센트 int ce = 30000 + data[8]; // 30000번대 페이트로 취급 if (data[10] == 0 /* || data[10] == 3 */) // 3은 진행했으면 알릴 의미가 없기 때문인데, 일단 패스 { // 제거 if (_missions.ContainsKey(ce)) { // 미션 목록에서 뺀다 _missions.TryRemove(ce, out _); } } else if (data[10] == 1) { // 알림 if (!_missions.ContainsKey(ce)) { // 미션 목록에 없으면 넣는다 _missions.TryAdd(ce, 0); // 일단 페이트 취급 bool isselected = Settings.CurrentFate.Selected.Contains(ce.ToString()); if (Settings.LoggingWholeFates || isselected) { var fate = GameData.GetFate(ce); Mesg.CriticalEngagement("l-fate-occured-info", fate.Name); if (isselected) { PlayEffectSound(txtSoundFile.Text); // 인스턴스 사운드 출력 _frmOverlay.EventFate(fate); if (_use_notify) { NotifyFate(fate); } } } } } #if true else if (Settings.LoggingWholeFates && (data[10] == 2 || data[10] == 3)) // 그냥 한번 로그에 남기자 { if (!_missions.ContainsKey(ce)) { // 미션 목록에 없으면 넣는다 _missions.TryAdd(ce, 0); if (Settings.CurrentFate.Selected.Contains(ce.ToString())) { var fate = GameData.GetFate(ce); Mesg.CriticalEngagement("l-fate-occured-info", fate.Name); } } } #endif } }
private void PacketHandler(string pid, byte[] message) { var opcode = BitConverter.ToUInt16(message, 18); if (opcode != GamePacket.Current.OpFate && opcode != GamePacket.Current.OpDuty && opcode != GamePacket.Current.OpMatch && opcode != GamePacket.Current.OpInstance) { return; } var data = message.Skip(32).ToArray(); // FATE if (opcode == GamePacket.Current.OpFate) { if (data[0] == GamePacket.Current.FateIndex) { var fcode = BitConverter.ToUInt16(data, 4); bool isselected = Settings.SelectedFates.Contains(fcode.ToString()); if (Settings.LoggingWholeFates || isselected) { var fate = GameData.GetFate(fcode); Mesg.Fate("l-fate-occured-info", fate.Name); if (isselected) { PlayEffectSound(txtSoundFate.Text); _frmOverlay.EventFate(fate); if (_use_notify) { NotifyFate(fate); } } } } } // 듀티 else if (opcode == GamePacket.Current.OpDuty) { // 안쓴다 // var status = data[0]; // var reason = data[4]; var rcode = data[GamePacket.Current.DutyRoulette]; if (rcode != 0) { // 루렛 var roulette = GameData.GetRoulette(rcode); Mesg.Duty("i-queue-roulette", roulette.Name); _frmOverlay.EventQueue(roulette.Name); } else { // 직접 골라 큐 var insts = new List <int>(); for (var i = 0; i < 5; i++) { var icode = BitConverter.ToUInt16(data, GamePacket.Current.DutyInstance + (i * 4)); if (icode == 0) { break; } } if (insts.Any()) { Mesg.Duty("i-queue-instance", string.Join(", ", insts.Select(x => GameData.GetInstance(x).Name).ToArray())); _frmOverlay.EventStatus(insts.Count); } } } // 매치 else if (opcode == GamePacket.Current.OpMatch) { var rcode = BitConverter.ToUInt16(data, GamePacket.Current.MatchRoulette); var icode = BitConverter.ToUInt16(data, GamePacket.Current.MatchInstance); string name; if (icode == 0 && rcode != 0) { // 이것 루렛 매칭 var roulette = GameData.GetRoulette(rcode); Mesg.Duty("i-matched", roulette.Name); name = roulette.Name; } else if (icode != 0) { // 이건 골라 매칭 var instance = GameData.GetInstance(icode); Mesg.Duty("i-matched", instance.Name); name = instance.Name; } else { // 루렛도 인스도 아녀 name = Mesg.GetText("l-unknown-instance", icode); } PlayEffectSound(txtSoundFile.Text); _frmOverlay.EventMatch(name); if (_use_notify) { NotifyMatch(name); } } // 인스턴스 관련 else if (opcode == GamePacket.Current.OpInstance && GamePacket.Current.OpInstance != 0) { if (data[4] == 0) { // 0은 최초 입장때만 나오므로 이거 쓰자 var icode = BitConverter.ToUInt16(data, GamePacket.Current.InstanceInstance); var instance = GameData.GetInstance(icode); Mesg.Duty("l-instance-enter", instance.Name); _frmOverlay.EventMatch(Mesg.GetText("l-instance-enter", instance.Name)); if (_use_notify) { NotifyMatch(instance.Name); } } else { // 조용히 시키자 _frmOverlay.EventNone(); } } }
// 실제 데이터 처리 하는 곳 private void PacketFFXIV_OnEventReceived(int pid, GameEvents gameevent, int[] args) { var clienttype = _pronets[pid].ClientType; var text = pid + "|" + clienttype + "|" + gameevent + "|"; var pos = 0; var isFate = false; switch (gameevent) { case GameEvents.InstanceEnter: // [0] = instance code case GameEvents.InstanceLeave: { if (args.Length > 0) { text += GameData.GetInstanceName(args[0]) + "|"; pos++; } _frmOverlay.EventNone(); } break; case GameEvents.FateBegin: // [0] = fate code { var fate = GameData.GetFate(args[0]); isFate = true; text += fate.Name + "|" + fate.Area.Name + "|"; pos++; if (Settings.SelectedFates.Contains(args[0].ToString())) // 모든 페이트를 골라도 목록에 있는것만 알려줌 { _frmOverlay.EventFate(GameData.GetFate(args[0])); PlayEffectSound(); } } break; case GameEvents.FateProgress: // [0] = fate code, [1] = progress case GameEvents.FateEnd: // [0] = fate code, [1] = status(?) { var fate = GameData.GetFate(args[0]); isFate = true; text += fate.Name + "|" + fate.Area.Name + "|"; pos++; } break; case GameEvents.MatchBegin: // [0] = match type(0,1), [1] = roulette code or instance count, [...] = instance { text += (MatchType)args[0] + "|"; pos++; switch ((MatchType)args[0]) { case MatchType.Roulette: var roulette = GameData.GetRoulette(args[1]); text += roulette.Name + "|"; pos++; _frmOverlay.EventRoulette(roulette); break; case MatchType.Assignment: text += args[1] + "|"; pos++; var p = pos; for (var i = p; i < args.Length; i++) { text += GameData.GetInstanceName(args[i]) + "|"; pos++; } _frmOverlay.EventStatus(args[1]); break; } } break; case GameEvents.MatchEnd: // [0] = end reason <MatchEndType> { text += (MatchResult)args[0] + "|"; pos++; #if false if (Settings.UseOverlay) { var mres = (MatchResult)args[0]; if (mres == MatchResult.Enter) { _frmOverlay.Hide(); } else { _frmOverlay.Show(); } } #endif _frmOverlay.EventNone(); } break; case GameEvents.MatchOrder: // [0] = order _frmOverlay.EventStatus(args[0]); break; case GameEvents.MatchStatus: // [0] = match type(2,3), [1] = instance code, [2] = status // [3] = tank, [4] = healer, [5] = dps { if ((MatchType)args[0] == MatchType.ShortStatus) { // 5.1 이전 var instance = GameData.GetInstance(args[1]); text += instance.Name + "|"; pos++; _frmOverlay.EventStatus(instance, args[3], args[4], args[5]); } else { // 5.1 부터 [6] = maxtank, [7] = maxhealer, [8] = maxdps _frmOverlay.EventStatus(args[3], args[4], args[5], args[6], args[7], args[8]); } } break; case GameEvents.MatchDone: // [0] = roulette code, [1] = instance code { var roulette = GameData.GetRoulette(args[0]); var instance = GameData.GetInstance(args[1]); text += roulette.Name + "|"; pos++; text += instance.Name + "|"; pos++; _frmOverlay.EventMatch(instance); PlayEffectSound(); } break; case GameEvents.MatchCancel: _frmOverlay.StopBlink(); break; } for (var i = pos; i < args.Length; i++) { text += args[i] + "|"; } if (isFate) { text += args[0] + "|"; } ActGlobals.oFormActMain.ParseRawLogLine(false, DateTime.Now, "00|" + DateTime.Now.ToString("O") + "|0048|F|" + text); }