private void Client_StatsReceived(ZloBFGame Game, Dictionary <string, float> List) { if (Game == ZloBFGame.BF_4) { BF4Stats.UpdateObject(); } }
public static void GetItemDetails(ZloBFGame game, string key, out string name, out string desc) { switch (game) { case ZloBFGame.BF_4: var translated = (JObject)GameData.BF4_items[key]; if (translated != null) { name = translated["rname"]?.ToObject <string>(); desc = translated["rdesc"]?.ToObject <string>(); } else { name = key; desc = string.Empty; } break; case ZloBFGame.BF_3: case ZloBFGame.BF_HardLine: case ZloBFGame.None: default: name = key; desc = string.Empty; break; } }
public void StateReceived(ZloBFGame game, string type, string message) { var t = DateTime.Now; Run DateText = new Run($"{t.ToShortTimeString()} : "); DateText.Foreground = new SolidColorBrush(Colors.White); Run GameText = new Run($"[{game}] "); GameText.Foreground = new SolidColorBrush(Colors.LightGreen); Run TypeText = new Run($"[{type}] "); TypeText.Foreground = new SolidColorBrush(Color.FromRgb(77, 188, 233)); Run MessageText = new Run($"{message}"); MessageText.Foreground = new SolidColorBrush(Colors.White); Paragraph NewParagraph = new Paragraph(); NewParagraph.Inlines.Add(DateText); NewParagraph.Inlines.Add(GameText); NewParagraph.Inlines.Add(TypeText); NewParagraph.Inlines.Add(MessageText); StateTextBox.Document.Blocks.Add(NewParagraph); }
private void Client_ItemsReceived(ZloBFGame Game, Dictionary <string, API_Item> List) { if (Game == ZloBFGame.BF_4) { Dispatcher.Invoke(() => { ItemsDG.ItemsSource = List; }); } }
public static string GetGameModeName(ZloBFGame game, string key) { switch (game) { case ZloBFGame.BF_3: if (API_BF3_GameModes.ContainsKey(key)) { return(API_BF3_GameModes[key]); } break; case ZloBFGame.BF_4: if (API_BF4_GameModes.ContainsKey(key)) { return(API_BF4_GameModes[key]); } break; case ZloBFGame.BF_HardLine: if (API_BFH_GameModes.ContainsKey(key)) { return(API_BFH_GameModes[key]); } break; case ZloBFGame.None: break; default: break; } return(key); }
private void Client_StatsReceived(ZloBFGame Game, Dictionary <string, float> List) { if (Game == ZloBFGame.BF_HardLine) { Dispatcher.Invoke(() => { StatsDG.ItemsSource = List; }); } }
internal void Parse(string mapsinfo, string mapsraw, ZloBFGame game) { API_MapBase[] oldmaps; if (Values != null) { oldmaps = Values.ToArray(); } else { oldmaps = null; } int oldcur = CurrentMapIndex; int oldnext = NextMapIndex; Clear(); //parse maps rotation string[] rawmgms = mapsraw.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < rawmgms.Length; i++) { //each map //name,gamemode var rawmgm = rawmgms[i].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (rawmgm.Length > 0) { var m = new API_MapBase(this) { MapName = API_Dictionaries.GetMapName(game, rawmgm[0]) }; if (rawmgm.Length > 1) { m.GameModeName = API_Dictionaries.GetMapName(game, rawmgm[1]); } else { m.GameModeName = string.Empty; } Add(i, m); } } //parse maps info var infos = mapsinfo.Split(';').Select(x => x.Split(',')).ToArray(); CurrentMapIndex = int.Parse(infos[1][0]); NextMapIndex = int.Parse(infos[1][1]); //if (LogicalCurrentMap != null) //{ // LogicalCurrentMap.OPC(nameof(LogicalCurrentMap.IsCurrent)); // LogicalCurrentMap.OPC(nameof(LogicalCurrentMap.IsNext)); //} //if (LogicalNextMap != null) //{ // LogicalNextMap.OPC(nameof(LogicalCurrentMap.IsCurrent)); // LogicalCurrentMap.OPC(nameof(LogicalCurrentMap.IsNext)); //} }
private void BF_Pipe_Loop(ZloBFGame game) { NamedPipeClientStream stream = null; string pipeName = null; switch (game) { case ZloBFGame.BF_3: stream = BF3_Pipe; pipeName = "venice_snowroller"; break; case ZloBFGame.BF_4: stream = BF4_Pipe; pipeName = "warsaw_snowroller"; break; case ZloBFGame.BF_HardLine: stream = BFH_Pipe; pipeName = "omaha_snowroller"; break; case ZloBFGame.None: default: break; } while (true) { try { if (!stream.IsConnected && Helpers.NamedPipeExists(pipeName)) { stream.Connect(); } else { Thread.Sleep(200); } while (stream.IsConnected) { byte[] buffer = new byte[1024]; int read = stream.Read(buffer, 0, buffer.Length); if (read > 0) { byte[] final = new byte[read + 1]; Buffer.BlockCopy(buffer, 0, final, 0, read + 1); ProcessPipeMessage(game, final, read); } Thread.Sleep(50); } } catch { } } }
internal API_Item(string flag, bool exists, ZloBFGame game) { FlagName = flag; ItemExists = exists; API_Dictionaries.GetItemDetails(game, flag, out var name, out var desc); ItemName = name; ItemDescription = desc; }
private void Client_ClanDogTagsReceived(ZloBFGame game, ushort dogtag1, ushort dogtag2, string clanTag) { if (game == ZloBFGame.BF_4) { Dispatcher.Invoke(() => { BF4_DT1.Text = dogtag1.ToString(); BF4_DT2.Text = dogtag2.ToString(); BF4_CT.Text = clanTag; }); } }
private void ZloClient_GameStateReceived(ZloBFGame game, string type, string message) { //[BF_4] [StateChanged] State_Game State_ClaimReservation 14 //= in-game //[BF_4] [StateChanged] State_GameLeaving State_ClaimReservation 0 //= left game //[BF_3] [StateChanged] State_Game State_NA 14 //= in-game // //no left game LatestGameState_Game = game; LatestGameState_Type = type; LatestGameState_Message = message; latestDate = DateTime.UtcNow; string trimmed = message.Trim(' '); var dllz = GetDllsList(game); if (dllz == null || game == ZloBFGame.None) { return; } switch (game) { case ZloBFGame.BF_3: if (trimmed == $"State_Game State_NA {CurrentPlayerID}") { foreach (var item in dllz) { RequestDLLInject(game, item); } } break; case ZloBFGame.BF_4: case ZloBFGame.BF_HardLine: if (trimmed == $"State_Game State_ClaimReservation {CurrentPlayerID}") { foreach (var item in dllz) { RequestDLLInject(game, item); } } break; default: break; } }
IList GetGUIServerList(ZloBFGame game) { switch (game) { case ZloBFGame.BF_3: return(BF3_GUI_Servers); case ZloBFGame.BF_4: return(BF4_GUI_Servers); case ZloBFGame.BF_HardLine: return(BFH_GUI_Servers); case ZloBFGame.None: default: return(null); } }
public List <string> GetDllsList(ZloBFGame game) { switch (game) { case ZloBFGame.BF_3: return(Bf3); case ZloBFGame.BF_4: return(Bf4); case ZloBFGame.BF_HardLine: return(BfH); case ZloBFGame.None: default: return(null); } }
BF_GUI_Server CreateServer(ZloBFGame game, IBFServerBase baseServer) { switch (game) { case ZloBFGame.BF_3: return(new BF3_GUI_Server(baseServer)); case ZloBFGame.BF_4: return(new BF4_GUI_Server(baseServer)); case ZloBFGame.BF_HardLine: return(new BFH_GUI_Server(baseServer)); case ZloBFGame.None: default: return(null); } }
public static bool TryDiscoverGame(ZloBFGame game, out string path) { //first check cache if (GamePaths.TryGetValue(game, out var p)) { if (File.Exists(p)) { path = p; return(true); } } //then check local folder //then check paths in 'DiscoveryPaths' //then check registry path = null; return(false); }
private void API_ZloClient_StatsReceived(ZloBFGame Game, Dictionary <string, float> List) { Task.Run(() => { switch (Game) { case ZloBFGame.BF_3: { m_BF3_Stats = JObject.Parse(BF3_stats_def); AssignStats(List, BF3_Stats); BF3_Stats_Handler(); File.WriteAllText(@$ "{CurrentPlayerName}_BF3_stats.json", BF3_Stats.ToString()); break; } case ZloBFGame.BF_4: { m_BF4_Stats = JObject.Parse(BF4_stats_def); AssignStats(List, BF4_Stats); BF4_Stats_Handler(); var str = BF4_Stats.ToString(); File.WriteAllText($"{CurrentPlayerName}_BF4_stats.json", str); File.WriteAllLines($"{CurrentPlayerName}_BF4_stats_raw.txt", List.Select(x => x.ToString())); break; } case ZloBFGame.BF_HardLine: BFH_Stats_Handler(); File.WriteAllLines($"{CurrentPlayerName}_BFH_stats_raw.txt", List.Select(x => x.ToString())); break; case ZloBFGame.None: break; default: break; } RaiseStatsReceived(Game, List); }); }
private void ParsePipeMessage(ZloBFGame game, string type, string message, out ServerBase Server, out bool IsInGame) { //StateChanging;State_Connecting State_ClaimReservation 14 //StateChanging;State_Connecting State_Game 14 //GameWaiting;14 //StateChanged;State_Game State_NA 14 if (message == $"State_Game State_NA {CurrentPlayerID}" || message == $"State_Game State_ClaimReservation {CurrentPlayerID}") { IsInGame = true; switch (game) { case ZloBFGame.BF_3: Server = BF3Servers.FirstOrDefault(x => x.Players.Any(z => z.Name == CurrentPlayerName)); IsInGame = true; break; case ZloBFGame.BF_4: Server = BF4Servers.FirstOrDefault(x => x.Players.Any(z => z.Name == CurrentPlayerName)); IsInGame = true; break; case ZloBFGame.BF_HardLine: Server = BFHServers.FirstOrDefault(x => x.Players.Any(z => z.Name == CurrentPlayerName)); IsInGame = true; break; case ZloBFGame.None: default: Server = null; IsInGame = false; break; } } else { IsInGame = false; Server = null; } }
private void RespondToChange(ZloBFGame game, IBFServerList senderList, IBFServerBase serverBase, ServerChangeTypes changeType) { Application.Current.Dispatcher.Invoke(() => { var guiList = GetGUIServerList(game); var equi = guiList.Cast <BF_GUI_Server>().FirstOrDefault(x => x.ID == serverBase.ServerID); switch (changeType) { case ServerChangeTypes.Add: if (equi == null) { guiList.Add(equi = CreateServer(game, serverBase)); } AnimateRow(DataGrids[game], equi); break; case ServerChangeTypes.Update: if (equi != null) { //notify the gui equi.UpdateAllProps(); AnimateRow(DataGrids[game], equi); } break; case ServerChangeTypes.Remove: //remove from current list if (equi != null) { guiList.Remove(equi); } break; default: break; } }); }
private void API_ZloClient_ItemsReceived(ZloBFGame Game, Dictionary <string, API_Item> List) { Task.Run(() => { switch (Game) { case ZloBFGame.BF_4: File.WriteAllLines($"{CurrentPlayerName}_BF4_items_raw.txt", List.Select(x => x.Value.ToString())); break; case ZloBFGame.BF_HardLine: File.WriteAllLines($"{CurrentPlayerName}_BFH_items_raw.txt", List.Select(x => x.Value.ToString())); break; case ZloBFGame.None: break; default: break; } RaiseItemsReceived(Game, List); }); }
internal API_BF4ServerBase(uint id, ZloBFGame subGame) : base(id, subGame) { }
protected BasePlayerInfoRequest(ZloBFGame game) { Game = game; }
public SubServerList(ZloBFGame game) : base(game) { }
public InjectDll(ZloBFGame game, string path) { Game = game; DllPath = path; }
public GetPlayerInfo(ZloBFGame game) : base(game) { }
public SetPlayerInfo(ZloBFGame game, ushort dogTagBasic, ushort dogTagAdv, string clanTag) : base(game) { DogTagBasic = dogTagBasic; DogTagAdvanced = dogTagAdv; ClanTag = clanTag; }
private void Client_GameStateReceived(ZloBFGame game, string type, string message) { Console.WriteLine($"[{game}] [{type}] {message}"); }
private void Client_ItemsReceived(ZloBFGame Game, Dictionary <string, API_Item> List) { Console.WriteLine($"Items Received for game : {Game},count = {List.Count}"); }
private void Client_StatsReceived(ZloBFGame Game, Dictionary <string, float> List) { Console.WriteLine($"Stats Received for game : {Game},count = {List.Count}"); }
internal ServerBase(uint id, ZloBFGame game) { ServerID = id; Game = game; }
private void API_ZloClient_ClanDogTagsReceived(ZloBFGame game, ushort dogtag1, ushort dogtag2, string clanTag) { ClanDogTagsPerGame[game] = (dogtag1, dogtag2, clanTag); }