// private void UpdateUiLanguage() { tabPageFates.Text = Mesg.GetText("ui-tab-1-text"); tabPageSetting.Text = Mesg.GetText("ui-tab-2-text"); tabPageNotify.Text = Mesg.GetText("ui-tab-3-text"); lblClientVersion.Text = Mesg.GetText("ui-client-version"); lblUiLanguage.Text = Mesg.GetText("ui-language"); lblGameLanguage.Text = Mesg.GetText("ui-in-game"); lblBackColor.Text = Mesg.GetText("ui-back-color"); lblDisplayFont.Text = Mesg.GetText("ui-display-font"); btnShowLogSetting.Text = Mesg.GetText("ui-show-log-setting"); btnClearLogs.Text = Mesg.GetText("ui-clear-logs"); btnReconnect.Text = Mesg.GetText("ui-reconnect"); chkWholeFates.Text = Mesg.GetText("ui-log-whole-fate"); chkUseOverlay.Text = Mesg.GetText("ui-enable-overlay"); chkUseSound.Text = Mesg.GetText("ui-enable-sound"); //btnSelectSound.Text = Mesg.GetText("ui-find"); label1.Text = Mesg.GetText("app-description"); btnTestNotify.Text = Mesg.GetText("ui-notift-test"); chkNtfUseLine.Text = Mesg.GetText("ui-notify-use-line"); lblNtfLineToken.Text = Mesg.GetText("ui-token"); chkNtfUseTelegram.Text = Mesg.GetText("ui-notify-use-telegram"); lblNtfTelegramId.Text = Mesg.GetText("ui-id"); lblNtfTelegramToken.Text = Mesg.GetText("ui-token"); _frmOverlay.SetInfoText("app-description"); ttCtrls.SetToolTip(btnBlinkOverlay, Mesg.GetText("tip-blink-overlay")); ttCtrls.SetToolTip(btnSelectSound, Mesg.GetText("tip-select-sound-dialog")); ttCtrls.SetToolTip(btnSoundPlay, Mesg.GetText("tip-sound-play")); btnLogFont.Text = $"{rtxLogger.Font.Name}, {rtxLogger.Font.Size}"; }
// 끝낼 준비 public void DeInitPlugin() { // _isPluginEnabled = false; _frmOverlay.Hide(); _frmOverlay = null; SaveSettings(); #if MACHINA // 마시나 if (_monitor != null) { _monitor.Stop(); _monitor = null; } #endif // _isInitSetting = false; _actTabPage = null; if (_actLabelStatus != null) { _actLabelStatus.Text = Mesg.GetText("l-plugin-stopped"); _actLabelStatus = null; } Mesg.SetTextBox(null); }
// 듀티 큐 상태 internal void EventStatus(int queue) { string msg = queue < 0 ? string.Empty : $"#{queue}"; this.Invoke((MethodInvoker)(() => { lblInfo.Text = Mesg.GetText("ov-duties-wait", msg);; })); }
private void btnSelectSoundFate_Click(object sender, EventArgs e) { var dg = new OpenFileDialog { Title = Mesg.GetText("ui-select-sound"), DefaultExt = "wav", Filter = "Wave (*.wav)|*.wav|All (*.*)|*.*" }; if (dg.ShowDialog() == DialogResult.OK) { txtSoundFate.Text = dg.FileName; SaveSettings(); } }
private async void BtnTestNotify_Click(object sender, EventArgs e) { string s = string.Format("{0} - {1}", Mesg.GetText("ui-notift-test"), Mesg.GetText("app-description")); if (chkNtfUseLine.Checked) { await InternalNotifyByLine(s); } if (chkNtfUseTelegram.Checked) { InternalNotifyByTelegram(s); } }
// public void DeInitPlugin() { // _isPluginEnabled = false; _frmOverlay.Hide(); _frmOverlay = null; SaveSettings(); // _isInitSetting = false; _actTabPage = null; if (_actLabelStatus != null) { _actLabelStatus.Text = Mesg.GetText("l-plugin-stopped"); _actLabelStatus = null; } Mesg.SetTextBox(null); }
// public static Instance GetInstance(int code) { return(Instances.TryGetValue(code, out Instance instance) ? instance : new Instance { Name = Mesg.GetText("l-unknown-instance", code) }); }
// public static Roulette GetRoulette(int code) { return(Roulettes.TryGetValue(code, out Roulette roulette) ? roulette : new Roulette { Name = Mesg.GetText("l-unknown-roulette", code) }); }
private void NotifyMatch(string name) { string s = Mesg.GetText("i-matched", name); SendNotify(s); }
private void NotifyFate(GameData.Fate fate) { string s = Mesg.GetText("l-fate-occured-info", fate.Name); SendNotify(s); }
private void ReadSettings() { _srset.AddControlSetting("LocaleUi", cboUiLanguage); _srset.AddControlSetting("LocaleGame", cboGameLanguage); _srset.AddControlSetting("LogBackColor", cboLogBackground); _srset.AddControlSetting("LoggingWholeFATEs", chkWholeFates); _srset.AddControlSetting("UseOverlay", chkUseOverlay); _srset.AddControlSetting("OverlayLocation", txtOverayLocation); _srset.AddControlSetting("SelectedFates", txtSelectedFates); _srset.AddControlSetting("UseSound", chkUseSound); _srset.AddControlSetting("SoundFile", txtSoundFile); _srset.AddControlSetting("LogFont", txtLogFont); _srset.AddControlSetting("ClientVersion", txtClientVersion); _srset.AddControlSetting("UpdateSkip", txtUpdateSkip); // _srset.AddControlSetting("NotifyUseLine", chkNtfUseLine); _srset.AddControlSetting("NotifyLineToken", txtNtfLineToken); _srset.AddControlSetting("NotifyUseTelegram", chkNtfUseTelegram); _srset.AddControlSetting("NotifyTelegramId", txtNtfTelegramId); _srset.AddControlSetting("NotifyTelegramToken", txtNtfTelegramToken); // _srset.AddControlSetting("SoundFate", txtSoundFate); if (File.Exists(Settings.Path)) { using (var fs = new FileStream(Settings.Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var xr = new XmlTextReader(fs)) { try { while (xr.Read()) { if (xr.NodeType != XmlNodeType.Element) { continue; } if (xr.LocalName == "SettingsSerializer") { _srset.ImportFromXml(xr); } } } catch (Exception ex) { _actLabelStatus.Text = Mesg.GetText("e-setting-load", ex.Message); } xr.Close(); } } // game version int.TryParse(txtClientVersion.Text, out int clientversion); for (int i = 0; i < GameVersion.Versions.Length; i++) { if (GameVersion.Versions[i].Index == clientversion) { cboClientVersion.SelectedIndex = i; break; } } // locale _localeUi = (Mesg.Locale)cboUiLanguage.SelectedItem; _localeGame = (Mesg.Locale)cboGameLanguage.SelectedItem; // fates Settings.LoggingWholeFates = chkWholeFates.Checked; try { var ss = txtOverayLocation.Text.Split(','); if (ss.Length == 2) { Settings.OverlayLocation = new Point(int.Parse(ss[0].Trim()), int.Parse(ss[1].Trim())); _frmOverlay.Location = Settings.OverlayLocation; } } catch { } // overlay if (chkUseOverlay.Checked) { _frmOverlay.Show(); } else { _frmOverlay.Hide(); } Settings.UseOverlay = chkUseOverlay.Checked; // sound CheckSoundEnable(); // font try { var ss = txtLogFont.Text.Split(','); if (ss.Length == 2) { var font = new Font(ss[0], float.Parse(ss[1]), FontStyle.Regular, GraphicsUnit.Point); if (font != null) { rtxLogger.Font = font; } } } catch { } finally { btnLogFont.Text = $"{rtxLogger.Font.Name}, {rtxLogger.Font.Size}"; } // CheckUseNotify(); // background color if (!string.IsNullOrWhiteSpace(cboLogBackground.Text)) { Color c = Color.FromName(cboLogBackground.Text); if (c.Equals(Color.Transparent)) { rtxLogger.BackColor = c; } } // _isInitSetting = true; }
// private void ActInitialize() { if (_isInActInit) { return; } // _isInActInit = true; Mesg.SetTextBox(rtxLogger); ActGlobals.oFormActMain.Shown -= OFormActMain_Shown; ReadMesg(); ReadGame(); // _actLabelStatus.Text = "Initializing..."; Dock = DockStyle.Fill; UpdateUiLanguage(); _actLabelStatus.Text = Mesg.GetText("l-plugin-started"); _actTabPage.Text = Mesg.GetText("app-name"); _actTabPage.Controls.Add(this); // _isPluginEnabled = true; // _srset = new SettingsSerializer(this); ReadSettings(); UpdateFates(); // string tagname = Settings.GetTagNameForUpdate(); //if (!Settings.TagName.Equals(tagname)) if (long.Parse(Settings.TagName) < long.Parse(tagname)) { Mesg.I("i-client-updated", tagname); if (!txtUpdateSkip.Text.Equals(tagname)) { Task.Run(() => { var res = MessageBox.Show( Mesg.GetText("i-visit-updated"), Mesg.GetText("app-name"), MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (res == DialogResult.Yes) { Process.Start("https://github.com/purutu/ACT.DFAssist/releases/latest"); } else { txtUpdateSkip.Text = tagname; SaveSettings(); } }); } } // _isInActInit = false; }
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 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 } }
// public static Area GetArea(int code) { return(Areas.TryGetValue(code, out Area area) ? area : new Area { Name = Mesg.GetText("l-unknown-area", code) }); }
// public static Fate GetFate(int code) { return(Fates.ContainsKey(code) ? Fates[code] : new Fate { Name = Mesg.GetText("l-unknown-fate", code) }); }
public void SetInfoText(string localtext) { lblInfo.Text = Mesg.GetText(localtext); }