Guest User

Untitled

a guest
Jun 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6.  
  7. namespace MiddleMan
  8. {
  9. class PlayerData
  10. {
  11. public static List<byte> Block2Client = new List<byte>();
  12. public static List<byte> Block2Server = new List<byte>();
  13. public static bool BlockPackets = false;//stops the GMS client sending packets when ccing/logging
  14. public static byte NumPortals = 1;//number of portals you've been in (for looting)
  15. public static byte lootType = 0;//0 = specific drops, 1 = mesos, 2 = all
  16. public static MapData Map;//Map info stored here(map items/players etc)
  17. public static System.Drawing.Point Pos = new System.Drawing.Point();//player pos
  18. static bool spam = false;
  19. static string spamMessage;
  20.  
  21. public static void Spam()
  22. {
  23. while (true)
  24. {
  25. if (spam)
  26. Client.Packets.SendSpam(spamMessage);
  27. else
  28. System.Threading.Thread.Sleep(2000);//Lets just slowwww stuff down kai
  29. }
  30. }
  31. public static bool ParseChat(string chat)
  32. {
  33.  
  34. if (chat.StartsWith("!"))
  35. {
  36. string[] splitted = chat.Split(' ');
  37. switch (splitted[0].Remove(0, 1).ToLower())
  38. {
  39. #region lad - loot all drops(when dropped)
  40. case "lad":
  41. lootType = 2;
  42. Server.Packets.SendNotice("This is GMTiara here! Foreigners is going on a vacation. Sorry you had to see that.");
  43. break;
  44. #endregion
  45. #region lsd - loot specific drops(when dropped)
  46. case "lsd"://loot drops specific
  47. lootType = 0;
  48. Server.Packets.SendNotice("Looting specific items only");
  49. break;
  50. #endregion
  51. #region lmd - loot meso drops(when dropped)
  52. case "lmd"://loot drops meso
  53. lootType = 1;
  54. Server.Packets.SendNotice("Looting mesos only");
  55. break;
  56. #endregion
  57. #region la - loot all drops(now)
  58. case "la"://loot all on floor now
  59. foreach (Item item in Map.Items)
  60. {
  61. Client.Packets.LootItem(item.UID, item.x, item.y);
  62. }
  63. break;
  64. #endregion
  65. #region lam - loot all mesos(now)
  66. case "lam"://loot all mesos
  67. foreach (Item item in Map.Items)
  68. {
  69. if (item.isMeso)
  70. Client.Packets.LootItem(item.UID, item.x, item.y);
  71. }
  72. break;
  73. #endregion
  74. #region spam
  75. case "spam":
  76. spam = spam == true ? false : true;
  77. try { spamMessage = splitted[1]; }
  78. catch { }
  79. break;
  80. #endregion
  81.  
  82. #region send packet hex string
  83. case "p":
  84. Client.Packets.SendHex(chat.Remove(0, 3));
  85. break;
  86. #endregion
  87. #region SendSkillToGMSClient
  88. case "skill":
  89. Server.Packets.AddSkill(int.Parse(splitted[1]));
  90. break;
  91. #endregion
  92. #region Packet speed
  93. case "speed":
  94. if (Client.Client.slowPacket)
  95. {
  96. Client.Client.slowPacket = false;
  97. Console.WriteLine("Normal packets");
  98. Server.Packets.SendNotice("Normal packet speed");
  99. }
  100. else
  101. {
  102. Client.Client.slowPacket = true;
  103. Console.WriteLine("Slow packets");
  104. Server.Packets.SendNotice("Slow packets");
  105. }
  106. break;
  107. #endregion
  108. #region Block packet ToClient
  109. case "2c":
  110. try
  111. {
  112. if (PlayerData.Block2Client.Contains(byte.Parse(splitted[1], System.Globalization.NumberStyles.HexNumber)))
  113. {
  114. PlayerData.Block2Client.Remove(byte.Parse(splitted[1], System.Globalization.NumberStyles.HexNumber));
  115. Server.Packets.SendNotice("Unblocking 0x" + splitted[1]);
  116. }
  117. else
  118. {
  119. PlayerData.Block2Client.Add(byte.Parse(splitted[1], System.Globalization.NumberStyles.HexNumber));
  120. Server.Packets.SendNotice("Blocking 0x" + splitted[1]);
  121. }
  122. StreamWriter sw = new StreamWriter("BlockToClient.txt");
  123. foreach (byte BYTE in Block2Client)
  124. sw.WriteLine("{0:X}", BYTE);
  125. sw.Close();
  126. }
  127. catch (Exception e)
  128. {
  129. Server.Packets.SendNotice(e.ToString());
  130. Server.Packets.SendNotice("failed lul");
  131. }
  132. break;
  133. #endregion
  134. #region Block packet ToServer
  135. case "2s":
  136. try
  137. {
  138. if (PlayerData.Block2Server.Contains(byte.Parse(splitted[1], System.Globalization.NumberStyles.HexNumber)))
  139. {
  140. PlayerData.Block2Server.Remove(byte.Parse(splitted[1], System.Globalization.NumberStyles.HexNumber));
  141. Server.Packets.SendNotice("Unblocking 0x" + splitted[1]);
  142. }
  143. else
  144. {
  145. PlayerData.Block2Server.Add(byte.Parse(splitted[1], System.Globalization.NumberStyles.HexNumber));
  146. Server.Packets.SendNotice("Blocking 0x" + splitted[1]);
  147. }
  148. StreamWriter sw = new StreamWriter("BlockToServer.txt");
  149. foreach (byte BYTE in Block2Server)
  150. sw.WriteLine("{0:X}", BYTE);
  151. sw.Close();
  152. }
  153. catch (Exception e)
  154. {
  155. Server.Packets.SendNotice(e.ToString());
  156. Server.Packets.SendNotice("failed lul");
  157. }
  158. break;
  159. #endregion
  160. #region Change job
  161. case "job":
  162. try
  163. {
  164. Server.Packets.ChangeJob(Convert.ToInt16(splitted[1]));
  165. }
  166. catch
  167. {
  168. Server.Packets.SendNotice("failed lul");
  169. }
  170. break;
  171. #endregion
  172. #region level
  173. case "level":
  174. try
  175. {
  176. Server.Packets.ChangeLevel(Convert.ToByte(splitted[1]));
  177. }
  178. catch
  179. {
  180. Server.Packets.SendNotice("failed lul");
  181. }
  182. break;
  183. #endregion
  184. #region blocked packets
  185. case "blocked":
  186. string blocked = "C->S: ";
  187. foreach (byte BYTE in PlayerData.Block2Server)
  188. {
  189. blocked = blocked + "0x" + BYTE.ToString("X2") + ", ";
  190. }
  191. blocked = blocked + " S->C: ";
  192. foreach (byte BYTE in PlayerData.Block2Client)
  193. {
  194. blocked = blocked + "0x" + BYTE.ToString("X2") + ", ";
  195. }
  196. Server.Packets.SendNotice(blocked);
  197. break;
  198. #endregion
  199. default:
  200. return true;
  201. }
  202. }
  203. else
  204. return true;
  205. return false;
  206. }
  207. }
  208.  
  209. public enum ToServer
  210. {
  211. _CharSelect = 0x13,
  212. _LoginToWorld = 0x14,
  213. _Pong = 0x19,
  214. _MovePlayer = 0x28,
  215. _CloseAttack = 0x2B,
  216. _Chat = 0x30,
  217. _NPC_TALK_CONT = 0x3B,
  218. _LootItem = 0xC0,
  219. _NpcMovement = 0xBB,
  220. }
  221. public enum ToClient
  222. {
  223. _SEND_LOGIN_INFO_REPLY = 0x00,
  224. _ServerIP = 0x0C,
  225. _ChangeChannel = 0x10,
  226. _Ping = 0x11,
  227. _UPDATE_STAT = 0x1C,
  228. _AddSkill = 0x21,
  229. _Notice = 0x41,
  230. _ChangeMap = 0x72,
  231. _MOVE_PLAYER = 0xA7,
  232. _ItemDropped = 0xEE,
  233. _SHOW_NPC = 0xE3,
  234. _CONTROL_NPC = 0xE5,
  235. _ANIMATE_NPC = 0xE6,
  236. _TakeDrop = 0xEF,
  237. _NPC_TALK = 0x10E,
  238. }
  239. }
Add Comment
Please, Sign In to add comment