Guest User

Untitled

a guest
Oct 22nd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.69 KB | None | 0 0
  1. #region :punch <user>
  2. case "punch":
  3. case "hit":
  4. {
  5. using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
  6. {
  7. int isDead = dbClient.getInt("SELECT dead FROM users WHERE name = '" + _Username + "'");
  8. int isArrested = dbClient.getInt("SELECT arrested FROM users WHERE name = '" + _Username + "'");
  9. {
  10. if (isArrested == 1 || isDead == 1 || isArrested == 1 && isDead == 1)
  11. {
  12. Room.sendWhisper(roomUser, _Username, "Something is preventing you from performing that action.");
  13. }
  14. else if (isArrested == 0 || isDead == 0 || isArrested == 0 && isDead == 0)
  15. {
  16. virtualUser User = userManager.getUser(args[1]);
  17.  
  18. if (roomUser.walkLock == true)
  19. {
  20.  
  21. }
  22. else
  23. {
  24. if (punchCdLooper != null)
  25. {
  26.  
  27. }
  28. else
  29. {
  30.  
  31. int canHit = dbClient.getInt("SELECT violence FROM rooms WHERE id = '" + _roomID + "'");
  32. int isAfk = dbClient.getInt("SELECT afk FROM users WHERE name = '" + User._Username + "'");
  33. int health_db_ko = dbClient.getInt("SELECT health FROM users WHERE name = '" + User._Username + "'");
  34. int Dead = dbClient.getInt("SELECT dead FROM users WHERE name = '" + User._Username + "'");
  35. int Arrested = dbClient.getInt("SELECT arrested FROM users WHERE name = '" + User._Username + "'");
  36. int in_gang = dbClient.getInt("SELECT in_gang FROM users WHERE name = '" + _Username + "'");
  37. int gang_id = dbClient.getInt("SELECT gang_id FROM users WHERE name = '" + _Username + "'");
  38. if (Arrested == 1 || Dead == 1 || Dead == 1 && Arrested == 1)
  39. {
  40. sendData("BK" + "You cannot perform this action on this user because they are dead or arrested." + Convert.ToChar(2));
  41. }
  42. else
  43. if (isAfk == 1)
  44. {
  45. sendData("BK" + "You cannot perform this action on this user because they are inactive. [AFK]" + Convert.ToChar(2));
  46. }
  47. else
  48. {
  49. if (isArrested < 1)
  50. {
  51. if (canHit == 1)
  52. {
  53.  
  54. }
  55. else
  56. {
  57. if (User._roomID == _roomID && (roomUser.Y == User.roomUser.Y && roomUser.X == User.roomUser.X) || (roomUser.Y + 1 == User.roomUser.Y && roomUser.X == User.roomUser.X) || (roomUser.Y - 1 == User.roomUser.Y && roomUser.X == User.roomUser.X) || (roomUser.Y == User.roomUser.Y && roomUser.X + 1 == User.roomUser.X) || (roomUser.Y == User.roomUser.Y && roomUser.X - 1 == User.roomUser.X))
  58. {
  59. //db queries
  60. int myHealth = dbClient.getInt("SELECT health FROM users WHERE name = '" + User._Username + "'");
  61. int str_mod = dbClient.getInt("SELECT str FROM users WHERE name = '" + _Username + "'");
  62. int myScene = dbClient.getInt("SELECT health FROM users WHERE name = '" + User._Username + "'");
  63.  
  64. //Normal Assault Generator
  65. Random randNum = new Random();
  66. int hit_dif_0 = randNum.Next(1, 4);
  67. int hit_dif_1 = randNum.Next(1, 9);
  68.  
  69. //what a user hits with normal assault
  70. int hit = str_mod * hit_dif_0 + hit_dif_1 + 3;
  71.  
  72. //what a user hits
  73. int hitgun = str_mod * hit_dif_0 + hit_dif_1 + 13;
  74.  
  75. int getHit = myHealth - hit;
  76.  
  77. if (getHit < 1 && _Username == User._Username)
  78. {
  79. sendData("BK" + "If you want to knock yourself out, just use the :die command." + Convert.ToChar(2));
  80. }
  81. else
  82. if (myHealth < 20)
  83. {
  84. dbClient.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + User._Username + "'");
  85. dbClient.runQuery("UPDATE users SET hits = hits + 1 WHERE name = '" + _Username + "'");
  86. dbClient.runQuery("UPDATE users SET punch = '1' WHERE name = '" + _Username + "'");
  87. Room.sendShout(roomUser, "\n\n*" + _Username + " swings at " + User._Username + ", causing " + hit + " damage*" + "" + " \n\n " + _Username + " swings at " + User._Username + ", causing " + hit + " damage*");
  88. virtualUser Target = userManager.getUser(args[1]);
  89. Target.Room.sendShout(Target.roomUser, "\n\n*" + Target._Username + " Notices my health is " + myScene + "*" + " \n\n " + Target._Username + " Notices my health is*" + myScene + "'");
  90. ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
  91. punchCdLooper = new Thread(punchCdStarter);
  92. punchCdLooper.Priority = ThreadPriority.Lowest;
  93. punchCdLooper.Start();
  94. }
  95. else
  96. if (myHealth > 20 && myHealth < 36)
  97. {
  98. dbClient.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + User._Username + "'");
  99. dbClient.runQuery("UPDATE users SET hits = hits + 1 WHERE name = '" + _Username + "'");
  100. dbClient.runQuery("UPDATE users SET punch = '1' WHERE name = '" + _Username + "'");
  101. Room.sendShout(roomUser, "\n\n*" + _Username + " swings at " + User._Username + ", causing " + hit + " damage*" + "" + " \n\n " + _Username + " swings at " + User._Username + ", causing " + hit + " damage*");
  102. ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
  103. punchCdLooper = new Thread(punchCdStarter);
  104. punchCdLooper.Priority = ThreadPriority.Lowest;
  105. punchCdLooper.Start();
  106. User.Room.sendShout(User.roomUser, "\n\n*" + User._Username + " Notices my health is "+ myScene + "*" + " \n\n " + User._Username + " Notices my health is*" + myScene +"'");
  107. }
  108. else
  109. if (myHealth > 36 && myHealth < 49)
  110. {
  111. dbClient.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + User._Username + "'");
  112. dbClient.runQuery("UPDATE users SET hits = hits + 1 WHERE name = '" + _Username + "'");
  113. dbClient.runQuery("UPDATE users SET punch = '1' WHERE name = '" + _Username + "'");
  114. Room.sendShout(roomUser, "\n\n*" + _Username + " swings at " + User._Username + ", causing " + hit + " damage*" + "" + " \n\n " + _Username + " swings at " + User._Username + ", causing " + hit + " damage*");
  115. User.Room.sendShout(User.roomUser, "\n\n*" + User._Username + " Notices my health is " + myScene + "*" + " \n\n " + User._Username + " Notices my health is*" + myScene +"'");
  116. ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
  117. punchCdLooper = new Thread(punchCdStarter);
  118. punchCdLooper.Priority = ThreadPriority.Lowest;
  119. punchCdLooper.Start();
  120.  
  121. }
  122. else
  123.  
  124. if (_Username == User._Username)
  125. {
  126. dbClient.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + User._Username + "'");
  127. dbClient.runQuery("UPDATE users SET hits = hits + 1 WHERE name = '" + _Username + "'");
  128.  
  129. dbClient.runQuery("UPDATE users SET punch = '0' WHERE name = '" + _Username + "'");
  130. Room.sendShout(roomUser, "\n\n*" + _Username + " swings at " + User._Username + ", causing " + hit + " damage*" + "" + " \n\n " + _Username + " swings at " + User._Username + ", causing " + hit + " damage*");
  131. ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
  132. punchCdLooper = new Thread(punchCdStarter);
  133. punchCdLooper.Priority = ThreadPriority.Lowest;
  134. punchCdLooper.Start();
  135. }
  136. else
  137. {
  138. dbClient.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + User._Username + "'");
  139. dbClient.runQuery("UPDATE users SET hits = hits + 1 WHERE name = '" + _Username + "'");
  140.  
  141. dbClient.runQuery("UPDATE users SET punch = '1' WHERE name = '" + _Username + "'");
  142. Room.sendShout(roomUser, "\n\n*" + _Username + " swings at " + User._Username + ", causing " + hit + " damage*" + "" + " \n\n " + _Username + " swings at " + User._Username + ", causing " + hit + " damage*");
  143. if (in_gang == 1)
  144. {
  145. dbClient.runQuery("UPDATE gang_corps SET kills = kills + '1' WHERE gang_id = '" + gang_id + "'");
  146. }
  147. ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
  148. punchCdLooper = new Thread(punchCdStarter);
  149. punchCdLooper.Priority = ThreadPriority.Lowest;
  150. punchCdLooper.Start();
  151. }
  152. if (health_db_ko < 1)
  153. {
  154. if (getHit < 1 && _Username == User._Username)
  155. {
  156. sendData("BK" + "If you want to knock yourself out, just use the :die command." + Convert.ToChar(2));
  157. }
  158. if (User._Mission == "[CW] Red Team" || User._Mission == "[CW] Blue Team")
  159. {
  160. Room.sendShout(roomUser, "\n\n*" + _Username + " lands a final blow on " + User._Username + ", knocking them out and sending them to the graveyard*" + "" + " \n\n " + _Username + " lands a final blow on " + User._Username + ", knocking them out and sending them to the graveyard*");
  161. User.sendData("D^" + "H" + Encoding.encodeVL64(423));
  162. User.sendData("BK" + "You were knocked out by another user and sent to the graveyard.");
  163. }
  164. if (User._Mission == "[Game] Deathmatch" || User._Mission == "[Game] Brawl")
  165. {
  166.  
  167. Room.sendShout(roomUser, "\n\n*" + _Username + " lands a final blow on " + User._Username + ", knocking them out and sending them to the lobby*" + "" + " \n\n " + _Username + " lands a final blow on " + User._Username + ", knocking them out and sending them to the lobby*");
  168. if (User._Mission == "[Game] Deathmatch")
  169. {
  170. if (_Mission == "[Game] Deathmatch")
  171. {
  172. dbClient.runQuery("UPDATE users SET game_dm = game_dm + '10' WHERE name = '" + _Username + "'");
  173. }
  174. User.sendData("D^" + "H" + Encoding.encodeVL64(21));
  175. User.sendData("BK" + "An administrator has summoned you.");
  176. }
  177. if (User._Mission == "[Game] Brawl")
  178. {
  179. if (_Mission == "[Game] Brawl")
  180. {
  181. dbClient.runQuery("UPDATE users SET game_brawl = game_brawl + '10' WHERE name = '" + _Username + "'");
  182. }
  183. User.sendData("D^" + "H" + Encoding.encodeVL64(21));
  184. User.sendData("BK" + "An administrator has summoned you." + Convert.ToChar(2));
  185. }
  186. User.refreshAppearance(true, true, true);
  187. dbClient.runQuery("UPDATE users SET health = '100' WHERE name = '" + User._Username + "'");
  188. }
  189. else
  190. {
  191. if (User._Mission == "[ARENA] Red")
  192. {
  193. if (_Mission == "[ARENA] Blue" || User._Mission == "[ARENA] Red")
  194. {
  195. dbClient.runQuery("UPDATE users SET game_bbj = game_bbj + '10' WHERE name = '" + _Username + "'");
  196. }
  197. User.sendData("D^" + "H" + Encoding.encodeVL64(21));
  198. User.sendData("BK" + "Thank you for playing in The Bubble Juice Arena.");
  199. dbClient.runQuery("UPDATE users SET bbj_red = '0' WHERE name = '" + User._Username + "'");
  200. dbClient.runQuery("UPDATE users SET bbj_blue = '0' WHERE name = '" + User._Username + "'");
  201. Room.sendShout(roomUser, "*Knocks out " + args[1] + ", sending them to the lobby*");
  202. }
  203. if (User._Mission == "[ARENA] Blue")
  204. {
  205. if (_Mission == "[ARENA] Blue" || User._Mission == "[ARENA] Red")
  206. {
  207. dbClient.runQuery("UPDATE users SET game_bbj = game_bbj + '10' WHERE name = '" + _Username + "'");
  208. }
  209. User.sendData("D^" + "H" + Encoding.encodeVL64(21));
  210. User.sendData("BK" + "Thank you for playing in The Bubble Juice Arena.");
  211. dbClient.runQuery("UPDATE users SET bbj_red = '0' WHERE name = '" + User._Username + "'");
  212. dbClient.runQuery("UPDATE users SET bbj_blue = '0' WHERE name = '" + User._Username + "'");
  213.  
  214. Room.sendShout(roomUser, "*Knocks out " + args[1] + ", beating them in The Bubble Juice Arena*");
  215. }
  216. // Money Generator
  217. if (_Credits < 0)
  218. {
  219. dbClient.runQuery("UPDATE users SET kills = '1' WHERE name = '" + _Username + "'");
  220. dbClient.runQuery("UPDATE users SET slap = '0' WHERE name = '" + _Username + "'");
  221. dbClient.runQuery("UPDATE users SET punch = '0' WHERE name = '" + _Username + "'");
  222.  
  223. User.sendData("BK" + "You have been knocked out by another user and sent to the hospital." + Convert.ToChar(2));
  224. Room.sendShout(roomUser, "\n\n*" + _Username + " knocks out " + User._Username + ", sending them to the hospital*" + "" + " \n\n " + _Username + " knocks out " + User._Username + ",sending them to the hospital*");
  225. Room.sendShout(roomUser, "\n\n*" + _Username + " searches " + User._Username + "'s body for cash, finds nothing*" + "" + " \n\n " + _Username + " searches " + User._Username + "'s body for cash, finds nothing*");
  226. dbClient.runQuery("UPDATE users SET kills = kills + 1 WHERE name = '" + _Username + "'");
  227. dbClient.runQuery("UPDATE users SET health = '100' WHERE name = '" + User._Username + "'");
  228. dbClient.runQuery("UPDATE users SET murder = '1' WHERE name = '" + _Username + "'");
  229. dbClient.runQuery("UPDATE users SET ooc = '1' WHERE id = '" + User._Username + "'");
  230. dbClient.runQuery("UPDATE users SET deaths = deaths + 1, dead = '1', time_dead = '10' WHERE name = '" + User._Username + "'");
  231. User._Mission = "[Injured]" + _Mission + "";
  232. refreshValueables(true, true);
  233. refreshAppearance(true, true, true);
  234. ThreadStart sendDeadStarter = new ThreadStart(knockOut);
  235. punchCdLooper = new Thread(sendDeadStarter);
  236. punchCdLooper.Priority = ThreadPriority.Lowest;
  237. punchCdLooper.Start();
  238. User.sendData("D^" + "H" + Encoding.encodeVL64(2));
  239. User.Handler.ProcessPacket("Eu" + Encoding.encodeVL64(13));
  240. User.Handler.ProcessPacket("Et" + Encoding.encodeVL64(13));
  241. ThreadStart koStarter = new ThreadStart(User.knockOut);
  242. User.deadLooper = new Thread(koStarter);
  243. User.deadLooper.Priority = ThreadPriority.Lowest;
  244. User.deadLooper.Start();
  245. }
  246. else
  247. {
  248. Random cash = new Random();
  249. int cash1 = cash.Next(1, 3);
  250. int cash2 = cash.Next(1, 10);
  251. int cash_final = cash1 + cash2;
  252.  
  253. User.sendData("D^" + "H" + Encoding.encodeVL64(2));
  254. User.sendData("BK" + "You have been knocked out by another user and sent to the hospital." + Convert.ToChar(2));
  255. Room.sendShout(roomUser, "\n\n*" + _Username + " knocks out " + User._Username + ", sending them to the hospital*" + "" + " \n\n " + _Username + " knocks out " + User._Username + ",sending them to the hospital*");
  256. Room.sendShout(roomUser, "\n\n*" + _Username + " searches " + User._Username + "'s body for cash, finds " + cash_final + " credits*" + "" + " \n\n " + _Username + " searches " + User._Username + "'s body for cash, finds 0 credits*");
  257. dbClient.runQuery("UPDATE users SET kills = kills + 1 WHERE name = '" + _Username + "'");
  258. dbClient.runQuery("UPDATE users SET health = '100' WHERE name = '" + User._Username + "'");
  259. dbClient.runQuery("UPDATE users SET murder = '1' WHERE name = '" + _Username + "'");
  260. dbClient.runQuery("UPDATE users SET ooc = '1' WHERE id = '" + User._Username + "'");
  261. dbClient.runQuery("UPDATE users SET deaths = deaths + 1, dead = '1', time_dead = '10' WHERE name = '" + User._Username + "'");
  262. User._Mission = "[Injured]" + _Mission + "";
  263. User.refreshValueables(true, true);
  264. refreshValueables(true, true);
  265. refreshAppearance(true, true, true);
  266. User.sendData("D^" + "H" + Encoding.encodeVL64(2));
  267. User.Handler.ProcessPacket("Eu" + Encoding.encodeVL64(13));
  268. User.Handler.ProcessPacket("Et" + Encoding.encodeVL64(13));
  269.  
  270. ThreadStart koStarter = new ThreadStart(User.knockOut);
  271. User.deadLooper = new Thread(koStarter);
  272. User.deadLooper.Priority = ThreadPriority.Lowest;
  273. User.deadLooper.Start();
  274. }
  275.  
  276. }
  277. }
  278. }
  279. else
  280. {
  281. if (User._roomID == _roomID && (roomUser.Y + 1 == User.roomUser.Y && roomUser.X + 1 == User.roomUser.X) || (roomUser.Y - 1 == User.roomUser.Y && roomUser.X - 1 == User.roomUser.X) || (roomUser.Y - 1 == User.roomUser.Y && roomUser.X + 1 == User.roomUser.X) || (roomUser.Y + 1 == User.roomUser.Y && roomUser.X - 1 == User.roomUser.X))
  282. {
  283. Room.sendShout(roomUser, "\n\n*" + _Username + " swings for " + User._Username + ", but misses*" + "" + " \n\n " + _Username + " swings for " + User._Username + ", but misses*");
  284. ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
  285. punchCdLooper = new Thread(punchCdStarter);
  286. punchCdLooper.Priority = ThreadPriority.Lowest;
  287. punchCdLooper.Start();
  288. }
  289. }
  290. }
  291. }
  292. }
  293. }
  294. }
  295.  
  296. }
  297. }
  298. }
  299. break;
  300. }
  301.  
  302. #endregion
Add Comment
Please, Sign In to add comment