Advertisement
EESweetieBot

RarityBot Command Example

Dec 3rd, 2016
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.21 KB | None | 0 0
  1. public static async void TryFill(string player, string sentence)
  2.         {
  3.             string[] Cmsg = sentence.Split(' ');
  4.             string[] Lmsg = sentence.ToLower().Split(' ');
  5.             int withpos = -1;
  6.             bool k = true;
  7.             if (Lmsg.Any(x => x.Contains("dont")))
  8.             {
  9.                 int wot = 1;
  10.                 foreach (string word in Lmsg)
  11.                 {
  12.                     if (word == "dont")
  13.                     {
  14.                         wot = wot * -1;
  15.                     }
  16.                 }
  17.                 if (wot == 1)
  18.                 {
  19.                     PM(player, "Okay dear...");
  20.                     k = false;
  21.                 }
  22.             }
  23.             if (k)
  24.             {
  25.                 if (Lmsg.Any(x => x.Equals("with")))
  26.                 {
  27.                     withpos = Array.IndexOf(Lmsg, "with");
  28.                 }
  29.                 if (withpos != -1)
  30.                 {
  31.                     if (Lmsg.Any(x => x.Any(char.IsDigit)))
  32.                     {
  33.                         int id = -1;
  34.                         foreach (string word in Lmsg) { if (Regex.IsMatch(word, @"[0-9]")) { id = int.Parse(Regex.Replace(word, "[^0-9]", string.Empty)); } }
  35.                         if (id != -1)
  36.                         {
  37.                             PM(player, "Got it dear! Filling the world with " + id);
  38.                             for (int y = 0; y <= worldy; y++)
  39.                             {
  40.                                 for (int x = 0; x <= worldx; x++)
  41.                                 {
  42.                                     con.Send("b", 0, x, y, id);
  43.                                     await Task.Delay(20);
  44.                                 }
  45.                             }
  46.                             PM(player, "Done!");
  47.                         }
  48.                     }
  49.                     else if (Lmsg.Any(x => wordNumbers.Contains(x)))
  50.                     {
  51.                         int id = WordNum(sentence.Remove(0, withpos));
  52.                         if (id != -1)
  53.                         {
  54.                             PM(player, "Got it dear! Filling the world with " + id);
  55.                             for (int y = 0; y <= worldy; y++)
  56.                             {
  57.                                 for (int x = 0; x <= worldx; x++)
  58.                                 {
  59.                                     con.Send("b", 0, x, y, id);
  60.                                     await Task.Delay(20);
  61.                                 }
  62.                             }
  63.                             PM(player, "Done!");
  64.                         }
  65.                         else
  66.                         {
  67.                             PM(player, "Would you mind saying it again? I couldn't hear the block id properly...");
  68.                         }
  69.                     }
  70.                     else
  71.                     {
  72.                         PM(player, "Would you mind saying it again? I couldn't hear the block id properly...");
  73.                     }
  74.                 }
  75.                 else
  76.                 {
  77.                     PM(player, "Would you mind saying it again? I couldn't detect where the block id should be...");
  78.                 }
  79.             }
  80.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement