private async Task Client_MessageReceived(SocketMessage MessageParam) { var Message = MessageParam as SocketUserMessage; var Context = new SocketCommandContext(Client, Message); if (Context.Message == null || Context.Message.Content == "") { return; } if (Context.User.IsBot) { return; } Spawn.UserSentMessage((SocketGuildUser)Context.User, (SocketTextChannel)Context.Channel); //Xp.UserSentMessage((SocketGuildUser)Context.User, (SocketTextChannel)Context.Channel); int ArgsPos = 0; if (!(Message.HasStringPrefix("p.", ref ArgsPos) || Message.HasMentionPrefix(Client.CurrentUser, ref ArgsPos))) { if (PokemonData.HasStarter(Context.Message.Author.Id)) { Xp.UserSentMessage((SocketGuildUser)Context.User, (SocketTextChannel)Context.Channel); } return; } var Result = await Command.ExecuteAsync(Context, ArgsPos, null); if (!Result.IsSuccess && Result.Error != CommandError.UnknownCommand) { Console.WriteLine($"{DateTime.Now} at Command: {Command.Search(Context, ArgsPos).Commands[0].Command.Name} in {Command.Search(Context, ArgsPos).Commands[0].Command.Module.Name}] {Result.ErrorReason}"); var embed = new EmbedBuilder(); if (Result.ErrorReason == "The input text has too few parameters.") { if (Command.Search(Context, ArgsPos).Commands[0].Command.Name == "pick") { embed.WithTitle("INVALID CHOICE"); embed.WithDescription("please pick a pokemon"); } else { embed.WithTitle("***ERROR***"); embed.WithDescription("This command requires something, check help command to see what it needs."); } } else { embed.WithTitle("***ERROR***"); embed.WithDescription(Result.ErrorReason); } await Context.Channel.SendMessageAsync("", embed : embed.Build()); } }
private Task EventHandler(SocketMessage message) { if (message.Author.IsBot) { return(Task.CompletedTask); } Recieved.Message = message; Xp.DoEvent(); return(Task.CompletedTask); }
void Start() { PlayerShell.damage = 30; if (thePlayerXP == null) { DontDestroyOnLoad(gameObject); thePlayerXP = this; } else { Destroy(gameObject); thePlayerXP.transform.position = transform.position; } }
public void die() { if (isDead) { return; } isDead = true; if (lastAttacker != null) { Xp xp = lastAttacker.gameObject.GetComponent <Xp>(); if (xp != null) { xp.receiveXp((1000 * unitData.Level)); } } }
void Update() { system = FindObjectOfType <LevelSystem>(); playerXp = FindObjectOfType <Xp>(); if (currentHealth <= 0) { Destroy(this.gameObject); Coin.coin++; ScoreManager.score += scoreValue; Xp.XpValue += 5; //Coin.CoinInstance.coin += coinNumber; //playerXp.XpValue += 5; Kills.kills += killNumber; } }
public override int GetHashCode() { int hash = 1; if (Level != 0) { hash ^= Level.GetHashCode(); } if (Xp != 0L) { hash ^= Xp.GetHashCode(); } if (Avatar != 0) { hash ^= Avatar.GetHashCode(); } if (ItemCount != 0L) { hash ^= ItemCount.GetHashCode(); } if (PokemonCount != 0L) { hash ^= PokemonCount.GetHashCode(); } if (PokecoinCount != 0L) { hash ^= PokecoinCount.GetHashCode(); } if (Team != 0) { hash ^= Team.GetHashCode(); } if (CatchStreak != 0) { hash ^= CatchStreak.GetHashCode(); } if (SpinStreak != 0) { hash ^= SpinStreak.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (Xp != 0L) { hash ^= Xp.GetHashCode(); } hash ^= returnedRewards_.GetHashCode(); if (oneTimeRewards_ != null) { hash ^= OneTimeRewards.GetHashCode(); } if (LevelDesc.Length != 0) { hash ^= LevelDesc.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public static void savePlayer() { string[] path = new string[] { HealthSave, BitcoinSave, FireWallSave, CrackerSave, OsSave, PlayerNameSave, PlayerTitleSave, ScannerSave, XpSave, DownloadSpeedSave, UploadSpeedSave, ConnectionSave, ipAddressSave }; string[] contents = new string[] { Health.ToString(), Bitcoin.ToString(), Firewall.ToString(), Cracker.ToString(), OperatingSystem.ToString(), PlayerName, PlayerTitle, Scanner.ToString(), Xp.ToString(), downSpeed.ToString(), upSpeed.ToString(), connectionStatus, ipAddress }; for (int i = 0; i < path.Length; i++) { string item = path[i]; string content = contents[i]; try { File.Delete(item); } catch { Console.WriteLine("savePlayer(File.Delete) return inoperatable....no big deal, continue..."); } StreamWriter saveGame = new StreamWriter(File.Open(item, FileMode.OpenOrCreate)); saveGame.Write(content); saveGame.Close(); } }//save everything done to [player]
public static bool DownloadSeriesDetails(VideoTags videoTags, bool prioritizeMatchDate, bool dontOverwriteTitle, Log jobLog) { XPathDocument Xp; XPathNavigator Nav; XPathExpression Exp; XPathNodeIterator Itr; // There are no TheTVDB mirrors, so skip that step // ****************** // Get the series ID // ****************** try { if (!String.IsNullOrWhiteSpace(videoTags.imdbId)) // If we have a specific IMDB movieId specified, look up the movie details on TVDB { Xp = new XPathDocument("http://www.thetvdb.com/api/GetSeriesByRemoteID.php?imdbid=" + videoTags.imdbId); } else if (!String.IsNullOrWhiteSpace(videoTags.tvdbId)) // If we have a specific TVDB seriesId specified, look up the series details { // First match by Episode name and then by Original broadcast date (by default prioritize match date is false) if (!MatchSeriesInformation(videoTags, videoTags.tvdbId, prioritizeMatchDate, dontOverwriteTitle, jobLog)) { return(MatchSeriesInformation(videoTags, videoTags.tvdbId, !prioritizeMatchDate, dontOverwriteTitle, jobLog)); } else { return(true); } } else // Generic search by name { Xp = new XPathDocument("http://www.thetvdb.com/api/GetSeries.php?seriesname=" + videoTags.Title); } Nav = Xp.CreateNavigator(); Exp = Nav.Compile("//Data/Series"); Itr = Nav.Select(Exp); } catch (Exception e) { jobLog.WriteEntry("Unable to connect to TVDB\r\nError -> " + e.ToString(), Log.LogEntryType.Warning); return(false); } while (Itr.MoveNext()) // loop through all series returned trying to find a match { string seriesID = XML.GetXMLTagValue("seriesid", Itr.Current.OuterXml); string seriesTitle = XML.GetXMLTagValue("SeriesName", Itr.Current.OuterXml); string[] aliasNames = XML.GetXMLTagValue("AliasNames", Itr.Current.OuterXml).Split('|'); // sometimes the alias matches // Compare the series title with the title of the recording if ((String.Compare(seriesTitle.Trim(), videoTags.Title.Trim(), CultureInfo.InvariantCulture, (CompareOptions.IgnoreSymbols | CompareOptions.IgnoreCase)) != 0) && (!aliasNames.Any(s => (String.Compare(s.Trim(), videoTags.Title.Trim(), CultureInfo.InvariantCulture, (CompareOptions.IgnoreSymbols | CompareOptions.IgnoreCase)) == 0)))) { continue; // Name mismatch } if (String.IsNullOrWhiteSpace(seriesID)) { continue; // can't do anything without seriesID } // First match by Episode name and then by Original broadcast date (by default prioritize match date is false) if (!MatchSeriesInformation(videoTags, seriesID, prioritizeMatchDate, dontOverwriteTitle, jobLog)) { if (MatchSeriesInformation(videoTags, seriesID, !prioritizeMatchDate, dontOverwriteTitle, jobLog)) { return(true); } // Else we continue looping through the returned series looking for a match if nothing matches } else { return(true); } } jobLog.WriteEntry("No match found on TVDB", Log.LogEntryType.Debug); return(false); // no match found }
//(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) //(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*) private void processFrame(object sender, EventArgs e) { if (capture == null)//very important to handel excption { try { capture = new Capture(0); //camera id you use } catch (NullReferenceException excpt) { MessageBox.Show(excpt.Message); } } IMG = capture.QueryFrame(); IMG_Post = IMG.CopyBlank(); GrayImg = IMG.Convert <Gray, Byte>(); int Xp, Yp, x1, y1, x2, y2; int Max_Y, Min_Y; double Xc, Yc, Zc; int i, j; //Scanning frames to catch black object which is shown by Computer camera for image processing //1-Find Xp and Yp for (i = 0; i < GrayImg.Width; i++) { for (j = 0; j < GrayImg.Height; j++) { if (GrayImg[j, i].Intensity > 20) { IMG_Post[j, i] = new Bgr(0, 0, 0); } else { IMG_Post[j, i] = new Bgr(255, 255, 255); } } } IMG_Post_Gray = IMG_Post.Convert <Gray, Byte>(); x1 = -1; for (i = 10; i < IMG_Post_Gray.Width - 10; i++) { for (j = 10; j < IMG_Post_Gray.Height - 10; j++) { if (IMG_Post_Gray[j, i].Intensity > 128) { x1 = i; break; } } if (x1 >= 0) { break; } } x2 = -1; for (i = IMG_Post_Gray.Width - 10; i >= 10; i--) { for (j = 10; j < IMG_Post_Gray.Height - 10; j++) { if (IMG_Post_Gray[j, i].Intensity > 128) { x2 = i; break; } } if (x2 >= 0) { break; } } y1 = -1; for (j = 10; i < IMG_Post_Gray.Height - 10; j++) { for (i = 10; i < IMG_Post_Gray.Width - 10; i++) { if (IMG_Post_Gray[j, i].Intensity > 128) { y1 = j; break; } } if (y1 >= 0) { break; } } y2 = -1; for (j = IMG_Post_Gray.Height - 10; j >= 10; j--) { for (i = 10; i < IMG_Post_Gray.Width - 10; i++) { if (IMG_Post_Gray[j, i].Intensity > 128) { y2 = j; break; } } if (y2 >= 0) { break; } } Xp = (x1 + x2) / 2; Yp = (y1 + y2) / 2; textBox1.Text = Xp.ToString(); textBox2.Text = Yp.ToString(); //2- Find Xc and Yc Xc = (float)Xp / IMG_Post_Gray.Width * 30; // Yc = (float)Yp / IMG_Post_Gray.Height * 20; // Min_Y = 0; Max_Y = 20; // bunuda sen hesapla //3- Find Zc Zc = Yc * (20.0 - 30.0) / (Max_Y - Min_Y) + Min_Y; //4-Calculate the Inverse try { imageBox1.Image = IMG; imageBox2.Image = GrayImg; imageBox3.Image = IMG_Post; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private Task MessageHandler(SocketMessage message) { string firstWord = message.Content.Split()[0]; bool pong = message.Author.Id == _client.CurrentUser.Id && firstWord == "Pinging..."; if (pong || (!message.Author.IsBot && !message.Author.IsWebhook)) { Recieved.Message = message; } else { return(Task.CompletedTask); } try { // Events BotMention.DoEvent().Wait(); Emojify.DoEvent().Wait(); Xp.DoEvent().Wait(); if (pong) { Ping.DoCommand(true).Wait(); } if (!message.Content.StartsWith(BaseConfig.GetConfig().Prefix) || message.Author.IsBot) { return(Task.CompletedTask); } string command = firstWord.Substring(1, firstWord.Length - 1).ToLower(); // Commands // Dev if (Evaluate.Aliases.Contains(command) && HasPerm(Evaluate.AllowedRoles)) { Evaluate.DoCommand().Wait(); } if (Ping.Aliases.Contains(command) && BotChannel()) { Ping.DoCommand(false).Wait(); } if (Restart.Aliases.Contains(command) && BotChannel() && HasPerm(Restart.AllowedRoles)) { Restart.DoCommand().Wait(); } if (Test.Aliases.Contains(command) && BotChannel() && HasPerm(Test.AllowedRoles)) { Test.DoCommand().Wait(); } // Fun if (Minesweeper.Aliases.Contains(command) && BotChannel()) { Minesweeper.DoCommand().Wait(); } if (MathEval.Aliases.Contains(command) && BotChannel()) { MathEval.DoCommand().Wait(); } // Info if (Commands.Commands.Aliases.Contains(command) && BotChannel()) { Commands.Commands.DoCommand().Wait(); } if (EmojiList.Aliases.Contains(command) && BotChannel()) { EmojiList.DoCommand().Wait(); } if (Leaderboard.Aliases.Contains(command) && BotChannel()) { Leaderboard.DoCommand().Wait(); } if (UserInfo.Aliases.Contains(command) && BotChannel()) { UserInfo.DoCommand().Wait(); } // Util if (AnswerRequest.Aliases.Contains(command)) { AnswerRequest.DoCommand().Wait(); } if (PingRequest.Aliases.Contains(command)) { PingRequest.DoCommand().Wait(); } if (Store.Aliases.Contains(command) && BotChannel()) { Store.DoCommand().Wait(); } } catch (Exception e) { foreach (var i in BaseConfig.GetConfig().Channels.BotTerminal) { ((IMessageChannel)_client.GetChannel(i)).SendMessageAsync($"```{e}```"); } } return(Task.CompletedTask); }
static void Main(string[] args) { Xp xp = new Xp(); xp.Executar(); }