Advertisement
Guest User

Untitled

a guest
Jan 13th, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.88 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Diagnostics;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using PlayerIOClient;
  11. using System.IO;
  12. using System.Threading;
  13. using System.Text.RegularExpressions;
  14. using System.Net;
  15. using System.Collections;
  16.  
  17. namespace EEArtistv21
  18. {
  19. public partial class Form1 : Form
  20. {
  21. private Connection con;
  22. private static Connection co;
  23. private string room;
  24. private string pass;
  25. private int accountOption = 1;
  26. public static int healer;
  27. public static int sickamount = 0;
  28. public static int woots = 0;
  29. string irritar = null;
  30. string myname = null;
  31. string nickname = null;
  32. Random randomanswer = new Random((int)(DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond));
  33.  
  34. private static string seguido = null;
  35. private static string imitado = null;
  36. private static string worldkey = "";
  37.  
  38. private static bool isFirstMovement = false;
  39.  
  40. private static double XPosDifference = 0;
  41. private static double YPosDifference = 0;
  42.  
  43. private static double myPlayerPosX = 0;
  44. private static double myPlayerPosY = 0;
  45.  
  46. private static bool chupando = true;
  47. private static string chupaomsg = "Dei {0} {1} {2} {3}";
  48. private static bool darrt = true;
  49.  
  50. private static string GenderFileName = "gender.txt";
  51. private static string NickFileName = "nick.txt";
  52.  
  53. private static Dictionary<string, bool> girls = new Dictionary<string, bool>();
  54. private static Dictionary<string, string> nicks = new Dictionary<string, string>();
  55.  
  56. public static Dictionary<int, bool> ingame = new Dictionary<int, bool>();
  57. public static Dictionary<int, bool> sick = new Dictionary<int, bool>();
  58. public static Dictionary<int, string> players = new Dictionary<int, string>();
  59. public static Dictionary<string, int> playeridsbyname = new Dictionary<string, int>();
  60. delegate void SetTextCallback(string text);
  61.  
  62. public const string wordRegex = "[a-zA-Z0-9_áàâãéèêíìîóòôõúùç]+";
  63. public const string wordRegex2 = "[a-z]+";
  64.  
  65. public class Healer
  66. {
  67. public bool isAlive;
  68. public string name;
  69. public int id;
  70. public int heals;
  71. public static int maxhealsdefault = 7;
  72. public static int maxheals = maxhealsdefault;
  73.  
  74. public void tellHeals()
  75. {
  76. //this.pmhealer(string.Format("You have {0} healing powers left!", this.heals));
  77. }
  78.  
  79. public void pmhealer(string pmMessage)
  80. {
  81. //sendPM(this.name, pmMessage);
  82. }
  83.  
  84. public bool exists()
  85. {
  86. return this.id != -1;
  87. }
  88.  
  89. }
  90.  
  91. public static Healer gameHealer;
  92.  
  93. public static void sendPM(string playerName, string pmMessage)
  94. {
  95. string chat = String.Format("/pm {0} {1}", playerName, pmMessage);
  96. Debug.Print(chat);
  97.  
  98. co.Send("say", chat);
  99. }
  100.  
  101. public Form1()
  102. {
  103. InitializeComponent();
  104. }
  105.  
  106. private void Form1_Load(object sender, EventArgs e)
  107. {
  108. emailTextBox.Text = "pilherio7@gmail.com";
  109. passwordTextBox.Text = "joaovictoroliveira";
  110. healUpDown.Text = Healer.maxheals.ToString();
  111. roomIDTextBox.Text = "";
  112.  
  113. addMod("alex18");
  114. addMod("tesla");
  115. addMod("explozion");
  116. addMod("cyclon2");
  117. addMod("gabiputinha");
  118. addMod("arkonagames");
  119. addMod("joaovictorcastro");
  120. }
  121.  
  122. #region Detect login method
  123. private string detectMethod(string u, string p, string r)
  124. {
  125. if (accountOption == 1)
  126. {
  127. if (!string.IsNullOrEmpty(u) && u.Contains("@"))
  128. {
  129. if (!string.IsNullOrEmpty(p))
  130. {
  131. var roomID = detectRoom(r);
  132. if (!string.IsNullOrEmpty(roomID))
  133. {
  134.  
  135. return null;
  136. }
  137. else
  138. {
  139. return "You need to add a room";
  140. }
  141. }
  142. else
  143. {
  144. return "You need to add your password";
  145. }
  146. }
  147. else
  148. {
  149. return "You need to add your E-mail";
  150. }
  151. }
  152. else if (accountOption == 2)
  153. {
  154. if (!string.IsNullOrEmpty(u))
  155. {
  156. var roomID = detectRoom(r);
  157. if (!string.IsNullOrEmpty(roomID))
  158. {
  159.  
  160. return null;
  161. }
  162. else
  163. {
  164. return "You need to add a room";
  165. }
  166. }
  167. else
  168. {
  169. return "You need to add your AccessToken";
  170. }
  171. }
  172. else if (accountOption == 3)
  173. {
  174. if (!string.IsNullOrEmpty(u))
  175. {
  176. if (!string.IsNullOrEmpty(p))
  177. {
  178. var roomID = detectRoom(r);
  179. if (!string.IsNullOrEmpty(roomID))
  180. {
  181.  
  182. return null;
  183. }
  184. else
  185. {
  186. return "You need to add a room";
  187. }
  188. }
  189. else
  190. {
  191. return "You need to add your GameAuthToken";
  192. }
  193. }
  194. else
  195. {
  196. return "You need to add your UserID";
  197. }
  198. }
  199.  
  200. else if (accountOption == 4)
  201. {
  202. if (!string.IsNullOrEmpty(u))
  203. {
  204. if (!string.IsNullOrEmpty(p))
  205. {
  206. var roomID = detectRoom(r);
  207. if (!string.IsNullOrEmpty(roomID))
  208. {
  209.  
  210. return null;
  211. }
  212. else
  213. {
  214. return "You need to add a room";
  215. }
  216. }
  217. else
  218. {
  219. return "You need to add your AuthToken";
  220. }
  221. }
  222. else
  223. {
  224. return "You need to add your UserID";
  225. }
  226. }
  227. return "Doesn't contains anything";
  228. }
  229. #endregion
  230.  
  231. #region detect roomID
  232. private string detectRoom(string room)
  233. {
  234.  
  235. if (room.StartsWith("http://") || room.StartsWith("www."))
  236. {
  237. Match m0 = Regex.Match(room, @"/games/(PW|BW)+[A-f0-9_-]{3,13}", RegexOptions.IgnoreCase);
  238. if (m0.Success)
  239. {
  240. return Convert.ToString(m0).Substring(7);
  241. }
  242. else
  243. {
  244. Match m00 = Regex.Match(room, @"/games/OW+[A-z0-9]{1,4}-.*", RegexOptions.IgnoreCase);
  245. if (m00.Success)
  246. {
  247. return Convert.ToString(m00).Substring(7).Replace("-", " ");
  248. }
  249. }
  250. return null;
  251. }
  252. else
  253. {
  254. Match m1 = Regex.Match(room, "(PW|BW)+[A-f0-9_-]{3,13}", RegexOptions.IgnoreCase);
  255. if (m1.Success)
  256. {
  257. return room;
  258. }
  259. else
  260. {
  261. Match m2 = Regex.Match(room, "OW+[A-z0-9]{1,4}-.*", RegexOptions.IgnoreCase);
  262. if (m2.Success)
  263. {
  264. return Convert.ToString(room).Replace("-", " ");
  265. }
  266. }
  267. return null;
  268. }
  269. }
  270. #endregion
  271.  
  272. #region login
  273. private void login(string a, string b, string c, string d)
  274. {
  275. room = c;
  276. pass = d;
  277. PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", a, b, LoginSuccess, LoginFail);
  278. }
  279. #endregion
  280.  
  281. private void LoginFail(PlayerIOClient.PlayerIOError error)
  282. {
  283. MessageBox.Show(error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  284. }
  285.  
  286.  
  287. private void LoginSuccess(PlayerIOClient.Client cl)
  288. {
  289. try
  290. {
  291. con = cl.Multiplayer.JoinRoom(room, null);
  292. co = con;
  293. con.Send("init");
  294. con.OnMessage += new MessageReceivedEventHandler(onMessage);
  295. con.OnDisconnect += delegate(object sender, string reason)
  296. {
  297. this.SetConnectButton("Connect");
  298. };
  299. }
  300. catch (PlayerIOError error)
  301. {
  302. MessageBox.Show(error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  303. }
  304. }
  305.  
  306.  
  307. private void onMessage(object sender, PlayerIOClient.Message m)
  308. {
  309. switch (m.Type)
  310. {
  311. case "god":
  312. try
  313. {
  314. string pnamegod = players[m.GetInt(0)].ToLower();
  315. if (players.ContainsKey(m.GetInt(0)) && pnamegod == seguido && pnamegod == imitado)
  316. con.Send("god", m.GetBoolean(1));
  317. }
  318. catch (Exception)
  319. { }
  320.  
  321. break;
  322. case "m":
  323. string moveusername;
  324. try
  325. {
  326. double PlayerPosX = m.GetDouble(1);
  327. double PlayerPosY = m.GetDouble(2);
  328. double SpeedX = m.GetDouble(3);
  329. double SpeedY = m.GetDouble(4);
  330. int ModifierX = m.GetInt(5);
  331. int ModifierY = m.GetInt(6);
  332. int Horizontal = m.GetInt(7);
  333. int Vertical = m.GetInt(8);
  334. double GravityMultiplier = 1;
  335. bool SpaceDown = m.GetBoolean(10);
  336.  
  337. moveusername = players[m.GetInt(0)].ToLower();
  338.  
  339. if (moveusername == imitado)
  340. {
  341. if (isFirstMovement)
  342. {
  343. XPosDifference = myPlayerPosX - PlayerPosX;
  344. YPosDifference = myPlayerPosY - PlayerPosY;
  345. isFirstMovement = false;
  346. }
  347.  
  348. myPlayerPosX = PlayerPosX + XPosDifference;
  349. myPlayerPosY = PlayerPosY + YPosDifference;
  350.  
  351. if (myPlayerPosX < 16)
  352. myPlayerPosX = 16;
  353. if (myPlayerPosY < 16)
  354. myPlayerPosY = 16;
  355.  
  356. con.Send("m", myPlayerPosX, myPlayerPosY, SpeedX, SpeedY, ModifierX, ModifierY, Horizontal, Vertical, GravityMultiplier, SpaceDown);
  357. }
  358. else if (moveusername == seguido)
  359. {
  360. myPlayerPosX = PlayerPosX;
  361. myPlayerPosY = PlayerPosY;
  362. Debug.Print(PlayerPosX.ToString());
  363. Debug.Print(myPlayerPosX.ToString());
  364. con.Send("m", PlayerPosX, PlayerPosY, SpeedX, SpeedY, ModifierX, ModifierY, Horizontal, Vertical, GravityMultiplier, SpaceDown);
  365. }
  366.  
  367. }
  368. catch (KeyNotFoundException e)
  369. {
  370. Debug.Print(String.Format("KeyNotFoundException: {0}", m.GetInt(0).ToString()));
  371. return;
  372. }
  373.  
  374. return;
  375. case "team":
  376. Debug.Print(m.GetInt(1).ToString());
  377. return;
  378. case "add":
  379. players[m.GetInt(0)] = m.GetString(1);
  380. //ingame[m.GetInt(0)] = true;
  381. playeridsbyname[m.GetString(1)] = m.GetInt(0);
  382. return;
  383.  
  384. case "write":
  385. string wmsg = m.GetString(1);
  386. string[] wsplit = wmsg.Split(new Char[] {'!', '.', ' '});
  387. string user = m.GetString(0).Split(new Char[] { ' ' })[1].ToLower();
  388.  
  389. if (!isMod(user))
  390. break;
  391.  
  392. if (wsplit.Length > 0 && isMod(user))
  393. {
  394. try
  395. {
  396. if ((wsplit[1].ToLower() == "code") && (wsplit[2] != null))
  397. con.Send("access", wsplit[2]);
  398. else if ((wsplit[1].ToLower() == "irritar") && (wsplit[2] != null))
  399. {
  400. if (wsplit[2].ToLower() == myname)
  401. {
  402. Thread.Sleep(1000);
  403. //con.Send("say", (user + ": eu vou irritar é você, seu palhaço")/*.ToUpper()*/);
  404. irritar = user;
  405. }
  406. else
  407. {
  408. irritar = wsplit[2].ToLower();
  409. Thread.Sleep(1000);
  410. //con.Send("say", ("agora vou irritar o " + irritar)/*.ToUpper()*/);
  411. }
  412. }
  413. else if (wmsg.StartsWith("*"))
  414. con.Send("say", wmsg.Remove(0, 1));
  415. else
  416. {
  417. Thread.Sleep(1000);
  418. con.Send("say", m.GetString(1)/*.ToUpper()*/);
  419. }
  420.  
  421. if (woots > 0 && (wsplit[1] == "woot"))
  422. giveWoot();
  423. Thread.Sleep(1500);
  424. }
  425. catch (Exception) { }
  426. }
  427.  
  428. Debug.WriteLine(user);
  429. Debug.WriteLine(wmsg);
  430. return;
  431. /*
  432. case "say_old":
  433. string msg2 = m.GetString(1);
  434. string username2;
  435.  
  436. try
  437. {
  438. username2 = m.GetString(0).ToLower();
  439. }
  440. catch (Exception e)
  441. {
  442. return;
  443. }
  444.  
  445. addChatText(string.Format("OLD: {0}: {1}", username2.ToUpper(), msg2));
  446.  
  447. return;*/
  448. case "say":
  449. string msg = m.GetString(1);
  450. string msgLowered = msg.ToLower();
  451. string[] SplitMsg = msg.Split(new Char[] {'!', '.', ' '});
  452. string command = null;
  453. string username;
  454. string Username;
  455.  
  456. try
  457. {
  458. command = SplitMsg[1].ToLower();
  459. }
  460. catch (Exception e)
  461. {
  462. }
  463.  
  464. try
  465. {
  466. username = players[m.GetInt(0)].ToLower();
  467. Username = char.ToUpper(username[0]) + username.Substring(1);
  468. }
  469. catch (KeyNotFoundException e)
  470. {
  471. Debug.Print(String.Format("KeyNotFoundException: {0}", m.GetInt(0).ToString()));
  472. return;
  473. }
  474.  
  475. //if (!isRoot(username))
  476. //return;
  477.  
  478.  
  479. addChatText(string.Format("{0}: {1}", username.ToUpper(), msg));
  480.  
  481. if (username == myname)
  482. return;
  483.  
  484. if (msgLowered.Contains(nickname) && msgLowered.EndsWith("?"))
  485. {
  486. int min = randomanswer.Next((new Random()).Next());
  487. int val = (77 * randomanswer.Next(min));
  488. int selectanswer = randomanswer.Next(min, val > min ? val : min) % 2;
  489. string answer = null;
  490. if (selectanswer == 0)
  491. answer = "Sim";
  492. else if (selectanswer == 1)
  493. answer = "Não";
  494.  
  495. con.Send("say", answer);
  496.  
  497. return;
  498. }
  499.  
  500. Dictionary<string, bool> eae = new Dictionary<string, bool>{
  501. {"eae", true},
  502. {"oi", true},
  503. {"olá", true},
  504. {"ola", true},
  505. {"rola", true},
  506. {"e aí", true},
  507. {"e ae", true},
  508. {"arroiz testando", true}
  509. };
  510.  
  511. if (eae.Contains(new KeyValuePair<string,bool>(msgLowered, true)))
  512. {
  513. con.Send("say", char.ToUpper(msgLowered[0]) + msgLowered.Substring(1) + " " + Username);
  514. return;
  515. }
  516. if (msg.ToLower() == "tchau")
  517. {
  518. con.Send("say", "Tchau " + Username);
  519. }
  520.  
  521. string eu = "eu";
  522.  
  523. if (msg.ToLower().StartsWith(eu) && msg.Length > eu.Length)
  524. {
  525. string tambemmsg = msg.Substring(eu.Length).Trim();
  526.  
  527. con.Send("say", "Eu também " + tambemmsg);
  528. return;
  529. }
  530. if (username == irritar)
  531. {
  532. string irritarmsg = msg;
  533.  
  534. con.Send("say", ((darrt ? (irritar + ": ") : "") + irritarmsg)/*.ToUpper()*/);
  535. }
  536. else
  537. if (isMod(username))
  538. {
  539. if (msg.StartsWith("*"))
  540. con.Send("say", msg.Substring(1));
  541. else if (msg.StartsWith("@"))
  542. con.Send("say", msg.Substring(1).ToUpper());
  543. }
  544.  
  545. if ((isRoot(username) || chupando) && SplitMsg.Length >= 2 && (msg[0] == '!'))
  546. {
  547. string tipodechupada = null;
  548. string verb = "Dei";
  549. string pre = "um";
  550. string sufix = "n";
  551. string male = "o";
  552. string female = "a";
  553.  
  554. if (command.Contains("chupar"))
  555. tipodechupada = "chupão";
  556.  
  557. else if (command.Contains("beijar"))
  558. tipodechupada = "beijão";
  559.  
  560. else if (command.Contains("lamber"))
  561. {
  562. pre = "uma";
  563. tipodechupada = "lambida";
  564. }
  565. else if (command.Contains("copular"))
  566. {
  567. verb = "";
  568. pre = "";
  569. tipodechupada = "Copulei";
  570. }
  571.  
  572. else if (command.Contains("rabo"))
  573. {
  574. pre = "o";
  575. tipodechupada = "rabão";
  576. sufix = "pr";
  577. }
  578. else if (command.Contains("galinha"))
  579. {
  580. pre = "uma";
  581. tipodechupada = "galinha";
  582. sufix = "pr";
  583. }
  584.  
  585. else if (command.Contains("fuder"))
  586. {
  587. pre = "uma";
  588. tipodechupada = "fudida";
  589. sufix = "n";
  590. }
  591.  
  592. else if (command.Contains("morder"))
  593. {
  594. pre = "uma";
  595. tipodechupada = "mordida";
  596. }
  597. else if (command.Contains("oco"))
  598. {
  599. verb = "Deixei";
  600. pre = "o";
  601. tipodechupada = "oco";
  602. }
  603.  
  604. string msgchupao = verb + " {0} {1} {2} {3}";
  605.  
  606. if (command == "darrt")
  607. darrt = true;
  608. else if (command == "naodarrt")
  609. darrt = false;
  610.  
  611. //else if (command.Contains("dar"))
  612.  
  613.  
  614. if (tipodechupada != null && SplitMsg.Length > 2)
  615. {
  616. string sendmsg = msg.Substring(SplitMsg[1].Length + 2);
  617. string pronoun = (sendmsg.Contains(myname) || command.EndsWith(female)) ? sufix + female : sufix + male;
  618. if (sendmsg.StartsWith("em"))
  619. {
  620. pronoun = "em";
  621. sendmsg = sendmsg.Substring(2);
  622. }
  623. if (sendmsg.StartsWith("a "))
  624. {
  625. pronoun = sufix + female;
  626. sendmsg = sendmsg.Substring(2);
  627. }
  628. if (sendmsg.StartsWith("o "))
  629. {
  630. sendmsg.Substring(2);
  631. }
  632. sendmsg = sendmsg.Trim();
  633.  
  634. if ((SplitMsg[2].ToLower() == "eu" || SplitMsg[2].ToLower() == "gay") && SplitMsg.Length == 3)
  635. sendmsg = username;
  636. Thread.Sleep(200);
  637. con.Send("say", String.Format(msgchupao, pre, tipodechupada, pronoun, sendmsg));
  638. Thread.Sleep(1000);
  639. return;
  640. }
  641. }
  642.  
  643. if (command == "significado" && msg.Length > 2)
  644. {
  645. string meaning = getMeaning(SplitMsg[2]);
  646. if (meaning != null)
  647. con.Send("say", ((meaning.Length > 140) ? meaning.Substring(0, 140) : meaning));
  648. }
  649.  
  650. if (!(msg.StartsWith("-") && isMod(username)))
  651. {
  652. string reply = msg.ToLower();
  653. string nick = myname.Substring(0, 4);
  654.  
  655. if (reply.Contains(nick))
  656. {
  657. MatchCollection allwords = Regex.Matches(reply, wordRegex2, RegexOptions.IgnoreCase);
  658.  
  659. foreach (Match match in allwords)
  660. {
  661. string word = match.Value;
  662.  
  663. try
  664. {
  665. if (word != "" && word.Length > 1)
  666. {
  667. bool isFeminine = word[word.Length - 1] == 'a';
  668.  
  669. string antonym = null;
  670.  
  671. if (isFeminine)
  672. antonym = getAntonym(word.Substring(0, word.Length - 1) + "o");
  673.  
  674. if (antonym == "" || antonym == null)
  675. antonym = getAntonym(word);
  676.  
  677. if (antonym != null && antonym != "" && antonym.Length > 1)
  678. {
  679. if (isFeminine)
  680. antonym = antonym.Substring(0, antonym.Length - 1) + "a";
  681. reply = reply.Replace(word, antonym);
  682. }
  683. }
  684. }
  685. catch (Exception e)
  686. {
  687. Debug.Print(e.StackTrace);
  688. }
  689. }
  690. Debug.Print(reply);
  691.  
  692.  
  693. bool isagirl = isGirl(username);
  694.  
  695. reply = reply.Replace(myname, Username);
  696. string nickreplace = nicks.ContainsKey(username) ? nicks[username] : Username;
  697. reply = reply.Replace(nick, nickreplace);
  698.  
  699. if (!isagirl)
  700. reply = reply.Replace("a " + Username, "o " + Username);
  701. reply = char.ToUpper(reply[0]) + reply.Substring(1);
  702. con.Send("say", reply.Substring(0, reply.Length > 140 ? 140 : reply.Length));
  703. }
  704. }
  705.  
  706. if (isMod(username) && (command == "chupaomsg" || command == "chuparmsg"))
  707. chupaomsg = msg.Substring(SplitMsg[1].Length + 2);
  708.  
  709. if (command == "feijoada" && SplitMsg.Length >= 2 && SplitMsg[2] != null)
  710. con.Send("access", SplitMsg[2]);
  711.  
  712. if (SplitMsg.Length > 0 && isMod(username) && (msg.StartsWith("!") || msg.StartsWith("#")))
  713. {
  714. try
  715. {
  716. if ((SplitMsg[1].ToLower() == "irritar") && (SplitMsg[2] != null) )
  717. {
  718. if (SplitMsg[2].ToLower() == myname)
  719. {
  720. Thread.Sleep(1000);
  721. //con.Send("say", (username + ": eu vou irritar é você, seu palhaço").ToUpper());
  722. irritar = username;
  723. }
  724. else
  725. {
  726. irritar = SplitMsg[2].ToLower();
  727. Thread.Sleep(1000);
  728. //con.Send("say", ("agora vou irritar o " + irritar)/*.ToUpper()*/);
  729. }
  730. }
  731.  
  732. if ((command == "estuprar" || command == "estrupar" || command == "seguir") && SplitMsg[2] != null)
  733. seguido = SplitMsg[2].ToLower();
  734.  
  735. if (command == "imitar" && SplitMsg[2] != null)
  736. {
  737. isFirstMovement = true;
  738. imitado = SplitMsg[2].ToLower();
  739. }
  740.  
  741. if (command == "nick" && SplitMsg.Length >= 4)
  742. {
  743. string name = SplitMsg[2].ToLower();
  744. string nick = msg.Substring(msg.IndexOf(SplitMsg[3], SplitMsg[0].Length + SplitMsg[1].Length + SplitMsg[2].Length));
  745. nicks[name] = nick;
  746.  
  747. if (!File.Exists(NickFileName))
  748. File.Create(NickFileName);
  749. File.AppendAllText(NickFileName, name + " " + nick + Environment.NewLine);
  750. }
  751.  
  752.  
  753.  
  754. int gendermin = 3;
  755. if (SplitMsg.Length >= gendermin)
  756. {
  757. string gender = command;
  758.  
  759. if (gender == "menino" || gender == "menina")
  760. {
  761. string all = "";
  762. int i;
  763.  
  764. if (!File.Exists(GenderFileName))
  765. File.Create(GenderFileName);
  766.  
  767. for (i = gendermin; i <= SplitMsg.Length; i++)
  768. {
  769. string comma = ", ";
  770. string name = SplitMsg[i - 1];
  771.  
  772. name = char.ToUpper(name[0]) + name.Substring(1).ToLower();
  773.  
  774. girls[name.ToLower()] = (gender == "menina");
  775.  
  776. File.AppendAllText(GenderFileName, name + " " + gender + Environment.NewLine);
  777.  
  778. if (i == gendermin)
  779. comma = "";
  780. else // if (i == (SplitMsg.Length - 1))
  781. comma = " e ";
  782.  
  783. all = all + comma + name;
  784. }
  785.  
  786. string add = "reconhecido";
  787. string was = "foi";
  788.  
  789. if (gender == "menina")
  790. add = "reconhecida";
  791.  
  792. if ((i - gendermin) > 1)
  793. {
  794. add = add + "s";
  795. was = "foram";
  796. gender = gender + "s";
  797. }
  798.  
  799. con.Send("say", String.Format("{0} {1} {2} como {3}", all, was, add, gender));
  800.  
  801. }
  802. }
  803.  
  804. try
  805. {
  806. if (command == "smiley" && SplitMsg.Length >= 2)
  807. con.Send(worldkey + "f", Int32.Parse(SplitMsg[2]));
  808. }
  809. catch (Exception)
  810. {
  811. break;
  812. }
  813.  
  814.  
  815. try
  816. {
  817. if (command == "xingar")
  818. {
  819. con.Send("say", msg.Substring(command.Length + 1).Trim() + " é viadão");
  820. Thread.Sleep(700);
  821. break;
  822. }
  823. }
  824. catch(Exception)
  825. {
  826.  
  827. }
  828.  
  829. if (isRoot(username))
  830. {
  831. if (command == "debug")
  832. {
  833. }
  834.  
  835.  
  836. if (command == "init")
  837. {
  838. con.Send("say", "Configurando 'GabiBotinha'...");
  839. Thread.Sleep(50000);
  840. /*
  841. con.Send("say", "Loading *.erl(Erlang) artificial intelligence files...");
  842. Thread.Sleep(1800);
  843. con.Send("say", "Loading online dictionary database...");
  844. Thread.Sleep(2200);
  845. con.Send("say", "Configuring 'GabiBotinha'...");
  846. Thread.Sleep(5000);
  847.  
  848. con.Send("say", @"Error: Could not configure files: 'bin\AI.erl', 'words\bom dia.erl'... (+135 files)");
  849. Thread.Sleep(700);
  850. con.Send("say", "Error traceback:");
  851. Thread.Sleep(700);
  852. con.Send("say", @"Lua state = new Lua();state.DoFile(@""Dictionary.lua"");Dictionary<object, object> t = state.GetTableDict(state.GetTable(""Dicio""));");
  853. Thread.Sleep(700);
  854. con.Send("say", @"Erlang AI = new Erlang(""FAI(OLT_M.D) -> FAI.T."");");
  855. Thread.Sleep(700);
  856. */
  857.  
  858. con.Send("say", "'GabiBotinha' foi configurada com sucesso. Reiniciando...");
  859. Thread.Sleep(700);
  860. con.Disconnect();
  861. }
  862.  
  863.  
  864. if (command == "naochupomais" && chupando)
  865. {
  866. chupando = false;
  867. Thread.Sleep(500);
  868. con.Send("say", "Não vou mais chupar vocês :*");
  869. Thread.Sleep(500);
  870. }
  871. if (command == "agoraeuchupo" && !chupando)
  872. {
  873. chupando = true;
  874. Thread.Sleep(500);
  875. con.Send("say", "Agora vou chupar vocês 3:)");
  876. Thread.Sleep(500);
  877. }
  878.  
  879. if (SplitMsg[1].ToLower() == "kiwi")
  880. {
  881. if (SplitMsg.Length >= 2)
  882. {
  883. if (addMod(SplitMsg[2]))
  884. {
  885. con.Send("say", string.Format("/pm {0} {1} foi adicionado(a) à lista de Kiwis!", username, SplitMsg[2]));
  886. Thread.Sleep(600);
  887. con.Send("say", string.Format("/pm {0} Você foi adicionado à lista de Kiwis!", SplitMsg[2]));
  888. }
  889. }
  890. }
  891.  
  892. if (SplitMsg[1].ToLower() == "sabonete")
  893. if (SplitMsg.Length >= 2)
  894. {
  895. if (removeMod(SplitMsg[2]))
  896. {
  897. con.Send("say", string.Format("/pm {0} {1} foi removido(a) da lista de Kiwis!", username, SplitMsg[2]));
  898. Thread.Sleep(600);
  899. con.Send("say", string.Format("/pm {0} Você foi removido da lista de Kiwis!", SplitMsg[2]));
  900. }
  901. }
  902. }
  903.  
  904.  
  905. if (SplitMsg[1] == "woot")
  906. con.Send("wootup");
  907.  
  908. Thread.Sleep(1500);
  909.  
  910. }
  911. catch (Exception) { }
  912. }
  913. return;
  914.  
  915. case "init":
  916. players.Clear();
  917. playeridsbyname.Clear();
  918. addChatText("-------------------------");
  919. addChatText(roomIDTextBox.Text);
  920.  
  921. con.Send("init2");
  922.  
  923. this.SetConnectButton("Disconnect");
  924. myname = players[m.GetInt(6)] = m.GetString(12);
  925. nickname = myname.Substring(0, 4);
  926. ingame[m.GetInt(6)] = false;
  927. woots = m.GetInt(4);
  928.  
  929. worldkey = derot(m.GetString(5));
  930. myPlayerPosX = m.GetInt(9);
  931. myPlayerPosY = m.GetInt(10);
  932.  
  933. return;
  934.  
  935. case "kill":
  936. Debug.Print(m.GetInt(0).ToString());
  937. ingame[m.GetInt(0)] = false;
  938. return;
  939.  
  940. case "left":
  941. players.Remove(m.GetInt(0));
  942. return;
  943.  
  944. case "effect":
  945.  
  946. return;
  947. }
  948. }
  949.  
  950. private static bool isGirl(string username)
  951. {
  952. return girls.ContainsKey(username.ToLower()) && (girls[username] == true);
  953. }
  954.  
  955. private static Dictionary<string, bool> ModList = new Dictionary<string,bool>();
  956.  
  957. private bool addMod(string username)
  958. {
  959. bool contains = isMod(username);
  960.  
  961. if (!contains)
  962. ModList.Add(username.ToLower(), true);
  963.  
  964. return !contains;
  965. }
  966.  
  967. private bool removeMod(string username)
  968. {
  969. bool contains = isMod(username);
  970. ModList.Remove(username.ToLower());
  971.  
  972. return contains;
  973. }
  974.  
  975. private static string[] rootList = {"chidore",
  976. "chidore2",
  977. "chidore4",
  978. "chidore7",
  979. "chidore8",
  980. "chidore9",
  981. "chidog",
  982. "eusouochidore",
  983. "naosouochidore",
  984. "cyclon2",
  985. "paodeforma",
  986. "arquona",
  987. "DARKITNOW",
  988. "rural",
  989. "chidori",
  990. "DARKITNOW",
  991. "CASTROVICTORJOAO",
  992. "joaovictorcastro"};
  993.  
  994. private bool isRoot(string username)
  995. {
  996. return rootList.Contains(username);
  997. }
  998.  
  999.  
  1000. private bool isMod(string username)
  1001. {
  1002. return isRoot(username) || ModList.ContainsKey(username.ToLower());
  1003. }
  1004.  
  1005. private void addChatText(string text)
  1006. {
  1007. if (this.getChatBox().InvokeRequired)
  1008. {
  1009. // It's on a different thread, so use Invoke.
  1010. SetTextCallback d = new SetTextCallback(adt);
  1011. this.Invoke
  1012. (d, new object[] { text });
  1013. }
  1014. else
  1015. {
  1016. // It's on the same thread, no need for Invoke
  1017. adt(text);
  1018. }
  1019. }
  1020.  
  1021. private void adt(string text)
  1022. {
  1023. getChatBox().AppendText(text + "\n");
  1024. }
  1025.  
  1026.  
  1027. private static char normalize(char c)
  1028. {
  1029. switch (c)
  1030. {
  1031. case 'á':
  1032. case 'à':
  1033. case 'â':
  1034. case 'ã':
  1035. return 'a';
  1036. case 'é':
  1037. case 'è':
  1038. case 'ê':
  1039. return 'e';
  1040. case 'í':
  1041. case 'ì':
  1042. case 'î':
  1043. return 'i';
  1044. case 'ó':
  1045. case 'ò':
  1046. case 'ô':
  1047. case 'õ':
  1048. return 'o';
  1049. case 'ú':
  1050. case 'ù':
  1051. case 'û':
  1052. return 'u';
  1053. case 'ç':
  1054. return 'c';
  1055. default:
  1056. return c;
  1057. }
  1058. }
  1059.  
  1060. public static string removeSpecial(string word)
  1061. {
  1062. string newWord = word;
  1063.  
  1064. for (int i = 0; i < word.Length; i++)
  1065. {
  1066. char c = word[i];
  1067. char normalized = normalize(c);
  1068.  
  1069. if (c != normalized)
  1070. newWord = newWord.Replace(c, normalized);
  1071. }
  1072.  
  1073. return newWord;
  1074. }
  1075.  
  1076. private static WebClient client = new WebClient();
  1077.  
  1078. public static string getMeaning(string word)
  1079. {
  1080. word = removeSpecial(word);
  1081. Debug.Print(word);
  1082. string meaning = null;
  1083. string link = "http://www.dicio.com.br/" + word + "/";
  1084.  
  1085. try
  1086. {
  1087. string lastWord = " Dicionário";
  1088. string meaningCode = "Significado de " + wordRegex + ": .*" + lastWord;
  1089. //string adjectiveCode = "<meta property=\"og:description\" content=\"Significado de " + word + ": adj.";
  1090. string downloadString = client.DownloadString(link);
  1091.  
  1092. Debug.Print(downloadString);
  1093.  
  1094. meaning = Regex.Match(downloadString, meaningCode, RegexOptions.IgnoreCase).Value;
  1095. meaning = meaning.Substring(0, meaning.Length - lastWord.Length);
  1096. Debug.Print(meaning);
  1097. }
  1098. catch (Exception e)
  1099. {
  1100. Debug.Print(link);
  1101. Debug.Print(e.Message);
  1102. }
  1103.  
  1104. return meaning;
  1105. }
  1106.  
  1107. static string derot(string arg1)
  1108. {
  1109. int num = 0;
  1110. string str = "";
  1111. for (int i = 0; i < arg1.Length; i++)
  1112. {
  1113. num = arg1[i];
  1114. if ((num >= 0x61) && (num <= 0x7a))
  1115. {
  1116. if (num > 0x6d) num -= 13;
  1117. else num += 13;
  1118. }
  1119. else if ((num >= 0x41) && (num <= 90))
  1120. {
  1121. if (num > 0x4d) num -= 13;
  1122. else num += 13;
  1123. }
  1124. str = str + ((char)num);
  1125. }
  1126. Console.WriteLine(str);
  1127. return str;
  1128. }
  1129.  
  1130. public static string getAntonym(string word)
  1131. {
  1132. string antonym = null;
  1133. string link = "http://www.dicio.com.br/" + word + "/";
  1134.  
  1135. try
  1136. {
  1137. string antonymCode = "Antônimo de " + word + ": <a href=\"/" + wordRegex + "/\">";
  1138. //string adjectiveCode = "<meta property=\"og:description\" content=\"Significado de " + word + ": adj.";
  1139. string downloadString = client.DownloadString(link);
  1140.  
  1141. antonym = Regex.Match(Regex.Match(Regex.Match(downloadString, antonymCode).Value, wordRegex + "/\">").Value, wordRegex).Value;
  1142. }
  1143. catch (Exception e)
  1144. {
  1145. Debug.Print(link);
  1146. Debug.Print(e.Message);
  1147. }
  1148.  
  1149. return antonym;
  1150. }
  1151.  
  1152. class loo
  1153. {
  1154. public static void penis(int userid, int sickbefore)
  1155. {
  1156. Thread.Sleep(100);
  1157. if (ingame[userid] && (sickamount < sickbefore) && (gameHealer.heals > 0) && gameHealer.exists())
  1158. {
  1159.  
  1160. if (gameHealer.heals <= 0)
  1161. {
  1162. Thread.Sleep(600);
  1163. co.Send("say", "/kill " + gameHealer.name);
  1164. gameHealer = new Healer();
  1165. }
  1166. }
  1167. }
  1168. }
  1169.  
  1170. private void button1_Click(object sender, EventArgs e)
  1171. {
  1172. if (connectButton.Text == "Connect")
  1173. {
  1174. string detectm = detectMethod(this.emailTextBox.Text, this.passwordTextBox.Text, this.roomIDTextBox.Text);
  1175. if (detectm == null)
  1176. {
  1177. var roomID = detectRoom(this.roomIDTextBox.Text);
  1178. if (roomID != null)
  1179. {
  1180. login(this.emailTextBox.Text, this.passwordTextBox.Text, roomID, null);
  1181. }
  1182. }
  1183. else
  1184. {
  1185.  
  1186. MessageBox.Show(detectm, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
  1187. }
  1188.  
  1189. }
  1190. else if (connectButton.Text == "Disconnect")
  1191. {
  1192. try
  1193. {
  1194.  
  1195. if (con.Connected)
  1196. {
  1197. con.Disconnect();
  1198. }
  1199. }
  1200. catch (Exception)
  1201. {
  1202.  
  1203. }
  1204. }
  1205. }
  1206.  
  1207.  
  1208. private delegate void SetConnectButtonCallback(string Text);
  1209. private void SetConnectButton(string Text)
  1210. {
  1211. if (this.connectButton.InvokeRequired)
  1212. {
  1213. try
  1214. {
  1215. SetConnectButtonCallback method = new SetConnectButtonCallback(this.SetConnectButton);
  1216. base.Invoke(method, new object[] { Text });
  1217. }
  1218. catch (Exception) { }
  1219. }
  1220. else
  1221. {
  1222. this.connectButton.Text = Text;
  1223. }
  1224. }
  1225.  
  1226. private void Form1_FormClosing(object sender, FormClosingEventArgs e)
  1227. {
  1228. if ((this.con != null) && this.con.Connected)
  1229. {
  1230. this.con.Disconnect();
  1231. }
  1232. }
  1233.  
  1234. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  1235. {
  1236. Healer.maxheals = (Int32)healUpDown.Value;
  1237. Debug.Print(Healer.maxheals.ToString());
  1238. }
  1239.  
  1240. private void SayButton_Click_1(object sender, EventArgs e)
  1241. {
  1242. if (con.Connected)
  1243. con.Send("say", textBox1.Text);
  1244. }
  1245.  
  1246. private void button1_Click_1(object sender, EventArgs e)
  1247. {
  1248. this.getChatBox().Clear();
  1249. }
  1250.  
  1251. private TextBox getChatBox()
  1252. {
  1253. return ChatBox;
  1254. }
  1255.  
  1256. private void timer1_Tick(object sender, EventArgs e)
  1257. {
  1258. WootsLabel.Text = String.Format("Woots: {0}", woots);
  1259. ModListBox.Items.Clear();
  1260. playersList.Items.Clear();
  1261. foreach (string v in ModList.Keys)
  1262. ModListBox.Items.Add(v);
  1263. foreach (string name in players.Values)
  1264. playersList.Items.Add(name);
  1265. }
  1266.  
  1267. private void WootButton_Click(object sender, EventArgs e)
  1268. {
  1269. giveWoot();
  1270. }
  1271.  
  1272. private void giveWoot()
  1273. {
  1274. if (co != null && co.Connected)
  1275. {
  1276. Thread.Sleep(250);
  1277. co.Send("wootup");
  1278. --woots;
  1279. }
  1280. }
  1281.  
  1282. private void button4_Click(object sender, EventArgs e)
  1283. {
  1284. con.Send("access", CodeTextBox.Text);
  1285. }
  1286. }
  1287. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement