public void SteamIDHashCodeUsesLongHashCode() { SteamID sid = 172376458626834; ulong longValue = 172376458626834; Assert.True(sid.GetHashCode() == longValue.GetHashCode()); }
public override int GetHashCode() { int hash = 1; if (ChannelID != 0UL) { hash ^= ChannelID.GetHashCode(); } if (DiscordID != 0UL) { hash ^= DiscordID.GetHashCode(); } if (SteamID != 0UL) { hash ^= SteamID.GetHashCode(); } if (DiscordTag.Length != 0) { hash ^= DiscordTag.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (ChannelID != 0UL) { hash ^= ChannelID.GetHashCode(); } if (SteamID.Length != 0) { hash ^= SteamID.GetHashCode(); } if (Duration.Length != 0) { hash ^= Duration.GetHashCode(); } if (Reason.Length != 0) { hash ^= Reason.GetHashCode(); } if (AdminTag.Length != 0) { hash ^= AdminTag.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { return(SteamID.GetHashCode()); }
static void Main(string[] args) { foreach (var memoria in MemoriaData) { string response = String.Empty; if (memoria[0] == '#') { response = memoria.Replace("#", String.Empty); AnswerAndQuestion[0] = response; } else if (memoria[0] == '-') { response = memoria.Replace("-", String.Empty); AnswerAndQuestion[1] = response; } if (!String.IsNullOrWhiteSpace(AnswerAndQuestion[0]) && !String.IsNullOrWhiteSpace(AnswerAndQuestion[1])) { try { bManager.brainData.Add(AnswerAndQuestion[0], AnswerAndQuestion[1]); } catch { //ignore same key } AnswerAndQuestion[0] = String.Empty; AnswerAndQuestion[1] = String.Empty; } } System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); //Commands ; try { CreateCommand("@braintwo", new Action(delegate() { bw.Interpreter("$0x", Argument[0]); })); CreateCommand("@brainfuck", new Action(delegate() { BrainfuckClient = new Brainfuck(Argument[0]); BrainfuckClient.RunCommand(Argument[0]); })); CreateCommand("@xvideos", new Action(delegate() { steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, "calma ae xo ve"); restart: try { List <string> commentsList = new List <string>(); string comment_(string a) { bool count = true; string result = String.Empty; for (int i = 0; i < a.Length; i++) { if (count) { if (a[i] != ',') { result = result + a[i]; } else { count = false; } } } return(result.Replace("\"", String.Empty).Replace(": ", String.Empty)); } WebClient web = new WebClient(); int numb = random.Next(1, 37); string link = $"https://www.xvideos.com/lang/portugues/{numb}"; string html = web.DownloadString(link); var id = Regex.Match(html, @"xv\.thumbs\.prepareVideo\(([0-9]+)\);").Groups[1].Value; string apicomment = $"https://www.xvideos.com/threads/video-comments/get-posts/top/{id}/0/0"; List <string> namesList = new List <string>(); using (WebClient wc = new WebClient()) { var json = wc.DownloadString(apicomment); JObject obj = JObject.Parse(json); var comments = obj["posts"]["posts"]; foreach (var key in comments) { string[] lName = key.ToString().Split(new string[] { "profile" }, StringSplitOptions.None); string[] l = key.ToString().Split(new string[] { "message" }, StringSplitOptions.None); commentsList.Add(comment_(l[1])); namesList.Add(comment_(lName[1])); } steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"{namesList[random.Next(0, namesList.Count)]} falou: {commentsList[random.Next(0, commentsList.Count)].Replace("&", String.Empty).Replace("<", String.Empty).Replace(";", String.Empty).Replace(">", String.Empty)}"); commentsList.Clear(); namesList.Clear(); } } catch { goto restart; } })); CreateCommand("@friends", new Action(delegate() { for (int i = 0; i < listFriendsSteamID.Count; i++) { Thread.Sleep(15); steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, steamFriends.GetFriendPersonaName(listFriendsSteamID[i])); } })); CreateCommand("@rpg", new Action(delegate() { Check: var account = dbConnection.Query("SELECT * from rpg_users WHERE id=@myid", new { myid = steamIDMemory.AccountID }).FirstOrDefault(); if (account != null) { steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Name: {account.UName}"); steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Class: {account.Class}"); steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Level: {account.Level}"); steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Exp: {account.Exp_}/15"); } else { try { var CreateAccount = dbConnection.Query( "INSERT INTO rpg_users(ID,Level,Exp_,Class,UName) VALUES (@id,@level,@exp,@class_,@uname)", new { id = steamIDMemory.AccountID, level = 0, exp = 0, class_ = "Archer", uname = steamFriends.GetFriendPersonaName(steamIDMemory) }); Thread.Sleep(30); goto Check; } catch { steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Error to create your account."); } } steamIDMemory = null; })); CreateCommand("@temp", new Action(delegate() { using (WebClient wc = new WebClient()) { try { var json = wc.DownloadString($@"https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22{Argument[0]}%22)%20and%20u%3D%22c%22&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"); JObject obj = JObject.Parse(json); var obj_ = obj["query"]["results"]["channel"]["item"].Select(x => new { temp = float.Parse(obj["query"]["results"]["channel"]["item"]["condition"]["temp"].ToString()), title = obj["query"]["results"]["channel"]["item"]["title"] }).ToArray(); steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"{obj_[0].title}"); steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Temperature: {obj_[0].temp} ºC"); } catch { steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Error to get temperature from this local."); } } })); CreateCommand("@bitcoin", new Action(delegate() { using (WebClient wc = new WebClient()) { try { var json = wc.DownloadString("https://blockchain.info/pt/ticker"); JObject obj = JObject.Parse(json); var price = obj[Argument[0]]["15m"]; var symbol = obj[Argument[0]]["symbol"]; steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Price Bitcoin from {Argument[0]}: {price} {symbol}"); } catch { steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Error to get price bitcoin from {Argument[0]}"); } } })); CreateCommand("@math", new Action(delegate() { using (WebClient wc = new WebClient()) { try { var json = wc.DownloadString($"https://newton.now.sh/simplify/{Argument[0]}"); JObject obj = JObject.Parse(json); var obj_ = obj["result"]; steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"{obj_}"); } catch { steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Error to expression {Argument[0]}"); } }; })); CreateCommand("@qrcode", new Action(delegate() { steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"https://api.qrserver.com/v1/create-qr-code/?size=150x150&data={Argument[0]}"); })); CreateCommand("@help", new Action(delegate() { var KeysCommands = Commands.Keys.ToArray(); steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, "=============================="); for (int i = 0; i < KeysCommands.Length; i++) { steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, KeysCommands[i]); } steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, "=============================="); })); CreateCommand("@room", new Action(delegate() { try { if (Argument[0] == "create") { RoomBehaviour room_ = new RoomBehaviour() { OwnerRoom = steamIDMemory, RoomID = steamIDMemory.GetHashCode(), CodeRoom = Argument[1] }; room_.UsersRoom.Add(steamIDMemory); Rooms_dic.Add(steamIDMemory.GetHashCode().ToString(), int.Parse(Argument[1])); Rooms.Add(room_); steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Sucess to create room! id: {Argument[1]}"); } if (Argument[0] == "list") { for (int i = 0; i < Rooms.Count; i++) { steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, Rooms[i].CodeRoom); } } if (Argument[0] == "join") { if (Rooms_dic.Values.Contains(int.Parse(Argument[1]))) { for (int i = 0; i < Rooms.Count; i++) { if (Rooms[i].CodeRoom == Argument[1]) { Rooms[i].UsersRoom.Add(steamIDMemory); steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, "Sucess to join in room!"); } } } } if (Argument[0] == "leave") { for (int i = 0; i < Rooms.Count; i++) { if (Rooms[i].UsersRoom.Contains(steamIDMemory)) { Rooms[i].UsersRoom.Remove(steamIDMemory); steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, "Sucess leave to room!"); } } } if (Argument[0] == "remove") { if (Rooms_dic.Values.Contains(int.Parse(Argument[1]))) { for (int i = 0; i < Rooms.Count; i++) { for (int x = 0; x < Rooms[i].UsersRoom.Count; x++) { Rooms[i].UsersRoom.RemoveAt(x); } if (Rooms[i].OwnerRoom == steamIDMemory) { Rooms_dic.Remove(steamIDMemory.GetHashCode().ToString()); Rooms.RemoveAt(i); steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, "Sucess to remove room!"); } } } else { steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, "Room not found!"); } } if (Argument[0] == "say") { string msg = String.Empty; for (int i = 0; i < Rooms.Count; i++) { if (Rooms[i].UsersRoom.Contains(steamIDMemory)) { for (int a = 0; a < Rooms[i].UsersRoom.Count; a++) { for (int c = 1; c < Argument.Length; c++) { try { if (!String.IsNullOrWhiteSpace(Argument[c])) { msg = msg + " " + Argument[c]; } } catch { } } steamFriends.SendChatMessage(Rooms[i].UsersRoom[a], EChatEntryType.ChatMsg, $"{steamFriends.GetFriendPersonaName(steamIDMemory)}: {msg}"); } } } } } catch (Exception ex) { steamFriends.SendChatMessage(steamIDMemory, EChatEntryType.ChatMsg, $"Error to execute command in room!"); } })); } catch { } // Invalids Commands Ignore! // if (currentStatus == scenes.Login) { using (StreamReader r = new StreamReader("SteamBot.json")) { string json_data = r.ReadToEnd(); JObject bot_data = JObject.Parse(json_data); if (bot_data["bot_data"]["autologin"].ToString() != "true") { Console.Write("Username: "******"Password: "******"bot_data"]["bot_name"].ToString() }; memory_[0] = bot_data["bot_data"]["bot_name"].ToString(); currentStatus = scenes.TryingConnect; } else { bot = new BOT() { name = bot_data["bot_login"]["bot_user"].ToString(), password = bot_data["bot_login"]["bot_password"].ToString(), personaname = bot_data["bot_data"]["bot_name"].ToString() }; memory_[0] = bot_data["bot_data"]["bot_name"].ToString(); currentStatus = scenes.TryingConnect; } } } if (currentStatus == scenes.TryingConnect) { steamClient = new SteamClient(); callbackManager = new CallbackManager(steamClient); steamUser = steamClient.GetHandler <SteamUser>(); steamFriends = steamClient.GetHandler <SteamFriends>(); callbackManager.Subscribe <SteamClient.ConnectedCallback>(onConnected); callbackManager.Subscribe <SteamClient.DisconnectedCallback>(OnDisconnected); callbackManager.Subscribe <SteamUser.LoggedOnCallback>(OnLoggedOn); callbackManager.Subscribe <SteamUser.LoggedOffCallback>(OnLoggedOff); callbackManager.Subscribe <SteamUser.AccountInfoCallback>(OnAccountInfo); callbackManager.Subscribe <SteamFriends.FriendsListCallback>(OnFriendsList); callbackManager.Subscribe <SteamFriends.PersonaStateCallback>(OnPersonaState); callbackManager.Subscribe <SteamFriends.FriendMsgCallback>(OnFriendMsg); botIsRunning = true; Console.Clear(); Console.WriteLine($"BOT {bot.name} Connecting to Steam..."); steamClient.Connect(); } while (botIsRunning) { callbackManager.RunWaitCallbacks(TimeSpan.FromSeconds(1)); CountToAddExp += 1; if (CountToAddExp >= 100) { CountToAddExp = 0; for (int i = 0; i < ListPlayingGame.Count; i++) { try { if (ListPlayingGame.Count > 0) { var QueryToAdd = dbConnection.Query("UPDATE rpg_users set Exp_ = Exp_ + 1 WHERE id=@myid", new { myid = ListPlayingGame[i].AccountID }); var SelectCheck = dbConnection.Query("SELECT * FROM rpg_users WHERE id=@myid", new { myid = ListPlayingGame[i].AccountID }).FirstOrDefault(); if (SelectCheck != null && SelectCheck.Exp_ >= 15) { var AddLevel = dbConnection.Query( "UPDATE rpg_users set Level = Level + 1 WHERE id=@myid", new { myid = ListPlayingGame[i].AccountID }); var RemoveExp = dbConnection.Query("UPDATE rpg_users set Exp_ = 0 WHERE id=@myid", new { myid = ListPlayingGame[i].AccountID }); steamFriends.SendChatMessage(ListPlayingGame[i], EChatEntryType.ChatMsg, "[RPG] You have reached a new Level"); } } } catch { } } } } Console.ReadLine(); }