Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region :punch <user>
- case "punch":
- case "hit":
- {
- using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
- {
- int isDead = dbClient.getInt("SELECT dead FROM users WHERE name = '" + _Username + "'");
- int isArrested = dbClient.getInt("SELECT arrested FROM users WHERE name = '" + _Username + "'");
- {
- if (isArrested == 1 || isDead == 1 || isArrested == 1 && isDead == 1)
- {
- Room.sendWhisper(roomUser, _Username, "Something is preventing you from performing that action.");
- }
- else if (isArrested == 0 || isDead == 0 || isArrested == 0 && isDead == 0)
- {
- virtualUser User = userManager.getUser(args[1]);
- if (roomUser.walkLock == true)
- {
- }
- else
- {
- if (punchCdLooper != null)
- {
- }
- else
- {
- int canHit = dbClient.getInt("SELECT violence FROM rooms WHERE id = '" + _roomID + "'");
- int isAfk = dbClient.getInt("SELECT afk FROM users WHERE name = '" + User._Username + "'");
- int health_db_ko = dbClient.getInt("SELECT health FROM users WHERE name = '" + User._Username + "'");
- int Dead = dbClient.getInt("SELECT dead FROM users WHERE name = '" + User._Username + "'");
- int Arrested = dbClient.getInt("SELECT arrested FROM users WHERE name = '" + User._Username + "'");
- int in_gang = dbClient.getInt("SELECT in_gang FROM users WHERE name = '" + _Username + "'");
- int gang_id = dbClient.getInt("SELECT gang_id FROM users WHERE name = '" + _Username + "'");
- if (Arrested == 1 || Dead == 1 || Dead == 1 && Arrested == 1)
- {
- sendData("BK" + "You cannot perform this action on this user because they are dead or arrested." + Convert.ToChar(2));
- }
- else
- if (isAfk == 1)
- {
- sendData("BK" + "You cannot perform this action on this user because they are inactive. [AFK]" + Convert.ToChar(2));
- }
- else
- {
- if (isArrested < 1)
- {
- if (canHit == 1)
- {
- }
- else
- {
- 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))
- {
- //db queries
- int myHealth = dbClient.getInt("SELECT health FROM users WHERE name = '" + User._Username + "'");
- int str_mod = dbClient.getInt("SELECT str FROM users WHERE name = '" + _Username + "'");
- int myScene = dbClient.getInt("SELECT health FROM users WHERE name = '" + User._Username + "'");
- //Normal Assault Generator
- Random randNum = new Random();
- int hit_dif_0 = randNum.Next(1, 4);
- int hit_dif_1 = randNum.Next(1, 9);
- //what a user hits with normal assault
- int hit = str_mod * hit_dif_0 + hit_dif_1 + 3;
- //what a user hits
- int hitgun = str_mod * hit_dif_0 + hit_dif_1 + 13;
- int getHit = myHealth - hit;
- if (getHit < 1 && _Username == User._Username)
- {
- sendData("BK" + "If you want to knock yourself out, just use the :die command." + Convert.ToChar(2));
- }
- else
- if (myHealth < 20)
- {
- dbClient.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + User._Username + "'");
- dbClient.runQuery("UPDATE users SET hits = hits + 1 WHERE name = '" + _Username + "'");
- dbClient.runQuery("UPDATE users SET punch = '1' WHERE name = '" + _Username + "'");
- Room.sendShout(roomUser, "\n\n*" + _Username + " swings at " + User._Username + ", causing " + hit + " damage*" + "" + " \n\n " + _Username + " swings at " + User._Username + ", causing " + hit + " damage*");
- virtualUser Target = userManager.getUser(args[1]);
- Target.Room.sendShout(Target.roomUser, "\n\n*" + Target._Username + " Notices my health is " + myScene + "*" + " \n\n " + Target._Username + " Notices my health is*" + myScene + "'");
- ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
- punchCdLooper = new Thread(punchCdStarter);
- punchCdLooper.Priority = ThreadPriority.Lowest;
- punchCdLooper.Start();
- }
- else
- if (myHealth > 20 && myHealth < 36)
- {
- dbClient.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + User._Username + "'");
- dbClient.runQuery("UPDATE users SET hits = hits + 1 WHERE name = '" + _Username + "'");
- dbClient.runQuery("UPDATE users SET punch = '1' WHERE name = '" + _Username + "'");
- Room.sendShout(roomUser, "\n\n*" + _Username + " swings at " + User._Username + ", causing " + hit + " damage*" + "" + " \n\n " + _Username + " swings at " + User._Username + ", causing " + hit + " damage*");
- ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
- punchCdLooper = new Thread(punchCdStarter);
- punchCdLooper.Priority = ThreadPriority.Lowest;
- punchCdLooper.Start();
- User.Room.sendShout(User.roomUser, "\n\n*" + User._Username + " Notices my health is "+ myScene + "*" + " \n\n " + User._Username + " Notices my health is*" + myScene +"'");
- }
- else
- if (myHealth > 36 && myHealth < 49)
- {
- dbClient.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + User._Username + "'");
- dbClient.runQuery("UPDATE users SET hits = hits + 1 WHERE name = '" + _Username + "'");
- dbClient.runQuery("UPDATE users SET punch = '1' WHERE name = '" + _Username + "'");
- Room.sendShout(roomUser, "\n\n*" + _Username + " swings at " + User._Username + ", causing " + hit + " damage*" + "" + " \n\n " + _Username + " swings at " + User._Username + ", causing " + hit + " damage*");
- User.Room.sendShout(User.roomUser, "\n\n*" + User._Username + " Notices my health is " + myScene + "*" + " \n\n " + User._Username + " Notices my health is*" + myScene +"'");
- ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
- punchCdLooper = new Thread(punchCdStarter);
- punchCdLooper.Priority = ThreadPriority.Lowest;
- punchCdLooper.Start();
- }
- else
- if (_Username == User._Username)
- {
- dbClient.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + User._Username + "'");
- dbClient.runQuery("UPDATE users SET hits = hits + 1 WHERE name = '" + _Username + "'");
- dbClient.runQuery("UPDATE users SET punch = '0' WHERE name = '" + _Username + "'");
- Room.sendShout(roomUser, "\n\n*" + _Username + " swings at " + User._Username + ", causing " + hit + " damage*" + "" + " \n\n " + _Username + " swings at " + User._Username + ", causing " + hit + " damage*");
- ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
- punchCdLooper = new Thread(punchCdStarter);
- punchCdLooper.Priority = ThreadPriority.Lowest;
- punchCdLooper.Start();
- }
- else
- {
- dbClient.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + User._Username + "'");
- dbClient.runQuery("UPDATE users SET hits = hits + 1 WHERE name = '" + _Username + "'");
- dbClient.runQuery("UPDATE users SET punch = '1' WHERE name = '" + _Username + "'");
- Room.sendShout(roomUser, "\n\n*" + _Username + " swings at " + User._Username + ", causing " + hit + " damage*" + "" + " \n\n " + _Username + " swings at " + User._Username + ", causing " + hit + " damage*");
- if (in_gang == 1)
- {
- dbClient.runQuery("UPDATE gang_corps SET kills = kills + '1' WHERE gang_id = '" + gang_id + "'");
- }
- ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
- punchCdLooper = new Thread(punchCdStarter);
- punchCdLooper.Priority = ThreadPriority.Lowest;
- punchCdLooper.Start();
- }
- if (health_db_ko < 1)
- {
- if (getHit < 1 && _Username == User._Username)
- {
- sendData("BK" + "If you want to knock yourself out, just use the :die command." + Convert.ToChar(2));
- }
- if (User._Mission == "[CW] Red Team" || User._Mission == "[CW] Blue Team")
- {
- 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*");
- User.sendData("D^" + "H" + Encoding.encodeVL64(423));
- User.sendData("BK" + "You were knocked out by another user and sent to the graveyard.");
- }
- if (User._Mission == "[Game] Deathmatch" || User._Mission == "[Game] Brawl")
- {
- 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*");
- if (User._Mission == "[Game] Deathmatch")
- {
- if (_Mission == "[Game] Deathmatch")
- {
- dbClient.runQuery("UPDATE users SET game_dm = game_dm + '10' WHERE name = '" + _Username + "'");
- }
- User.sendData("D^" + "H" + Encoding.encodeVL64(21));
- User.sendData("BK" + "An administrator has summoned you.");
- }
- if (User._Mission == "[Game] Brawl")
- {
- if (_Mission == "[Game] Brawl")
- {
- dbClient.runQuery("UPDATE users SET game_brawl = game_brawl + '10' WHERE name = '" + _Username + "'");
- }
- User.sendData("D^" + "H" + Encoding.encodeVL64(21));
- User.sendData("BK" + "An administrator has summoned you." + Convert.ToChar(2));
- }
- User.refreshAppearance(true, true, true);
- dbClient.runQuery("UPDATE users SET health = '100' WHERE name = '" + User._Username + "'");
- }
- else
- {
- if (User._Mission == "[ARENA] Red")
- {
- if (_Mission == "[ARENA] Blue" || User._Mission == "[ARENA] Red")
- {
- dbClient.runQuery("UPDATE users SET game_bbj = game_bbj + '10' WHERE name = '" + _Username + "'");
- }
- User.sendData("D^" + "H" + Encoding.encodeVL64(21));
- User.sendData("BK" + "Thank you for playing in The Bubble Juice Arena.");
- dbClient.runQuery("UPDATE users SET bbj_red = '0' WHERE name = '" + User._Username + "'");
- dbClient.runQuery("UPDATE users SET bbj_blue = '0' WHERE name = '" + User._Username + "'");
- Room.sendShout(roomUser, "*Knocks out " + args[1] + ", sending them to the lobby*");
- }
- if (User._Mission == "[ARENA] Blue")
- {
- if (_Mission == "[ARENA] Blue" || User._Mission == "[ARENA] Red")
- {
- dbClient.runQuery("UPDATE users SET game_bbj = game_bbj + '10' WHERE name = '" + _Username + "'");
- }
- User.sendData("D^" + "H" + Encoding.encodeVL64(21));
- User.sendData("BK" + "Thank you for playing in The Bubble Juice Arena.");
- dbClient.runQuery("UPDATE users SET bbj_red = '0' WHERE name = '" + User._Username + "'");
- dbClient.runQuery("UPDATE users SET bbj_blue = '0' WHERE name = '" + User._Username + "'");
- Room.sendShout(roomUser, "*Knocks out " + args[1] + ", beating them in The Bubble Juice Arena*");
- }
- // Money Generator
- if (_Credits < 0)
- {
- dbClient.runQuery("UPDATE users SET kills = '1' WHERE name = '" + _Username + "'");
- dbClient.runQuery("UPDATE users SET slap = '0' WHERE name = '" + _Username + "'");
- dbClient.runQuery("UPDATE users SET punch = '0' WHERE name = '" + _Username + "'");
- User.sendData("BK" + "You have been knocked out by another user and sent to the hospital." + Convert.ToChar(2));
- 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*");
- 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*");
- dbClient.runQuery("UPDATE users SET kills = kills + 1 WHERE name = '" + _Username + "'");
- dbClient.runQuery("UPDATE users SET health = '100' WHERE name = '" + User._Username + "'");
- dbClient.runQuery("UPDATE users SET murder = '1' WHERE name = '" + _Username + "'");
- dbClient.runQuery("UPDATE users SET ooc = '1' WHERE id = '" + User._Username + "'");
- dbClient.runQuery("UPDATE users SET deaths = deaths + 1, dead = '1', time_dead = '10' WHERE name = '" + User._Username + "'");
- User._Mission = "[Injured]" + _Mission + "";
- refreshValueables(true, true);
- refreshAppearance(true, true, true);
- ThreadStart sendDeadStarter = new ThreadStart(knockOut);
- punchCdLooper = new Thread(sendDeadStarter);
- punchCdLooper.Priority = ThreadPriority.Lowest;
- punchCdLooper.Start();
- User.sendData("D^" + "H" + Encoding.encodeVL64(2));
- User.Handler.ProcessPacket("Eu" + Encoding.encodeVL64(13));
- User.Handler.ProcessPacket("Et" + Encoding.encodeVL64(13));
- ThreadStart koStarter = new ThreadStart(User.knockOut);
- User.deadLooper = new Thread(koStarter);
- User.deadLooper.Priority = ThreadPriority.Lowest;
- User.deadLooper.Start();
- }
- else
- {
- Random cash = new Random();
- int cash1 = cash.Next(1, 3);
- int cash2 = cash.Next(1, 10);
- int cash_final = cash1 + cash2;
- User.sendData("D^" + "H" + Encoding.encodeVL64(2));
- User.sendData("BK" + "You have been knocked out by another user and sent to the hospital." + Convert.ToChar(2));
- 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*");
- 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*");
- dbClient.runQuery("UPDATE users SET kills = kills + 1 WHERE name = '" + _Username + "'");
- dbClient.runQuery("UPDATE users SET health = '100' WHERE name = '" + User._Username + "'");
- dbClient.runQuery("UPDATE users SET murder = '1' WHERE name = '" + _Username + "'");
- dbClient.runQuery("UPDATE users SET ooc = '1' WHERE id = '" + User._Username + "'");
- dbClient.runQuery("UPDATE users SET deaths = deaths + 1, dead = '1', time_dead = '10' WHERE name = '" + User._Username + "'");
- User._Mission = "[Injured]" + _Mission + "";
- User.refreshValueables(true, true);
- refreshValueables(true, true);
- refreshAppearance(true, true, true);
- User.sendData("D^" + "H" + Encoding.encodeVL64(2));
- User.Handler.ProcessPacket("Eu" + Encoding.encodeVL64(13));
- User.Handler.ProcessPacket("Et" + Encoding.encodeVL64(13));
- ThreadStart koStarter = new ThreadStart(User.knockOut);
- User.deadLooper = new Thread(koStarter);
- User.deadLooper.Priority = ThreadPriority.Lowest;
- User.deadLooper.Start();
- }
- }
- }
- }
- else
- {
- 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))
- {
- Room.sendShout(roomUser, "\n\n*" + _Username + " swings for " + User._Username + ", but misses*" + "" + " \n\n " + _Username + " swings for " + User._Username + ", but misses*");
- ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
- punchCdLooper = new Thread(punchCdStarter);
- punchCdLooper.Priority = ThreadPriority.Lowest;
- punchCdLooper.Start();
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- break;
- }
- #endregion
Add Comment
Please, Sign In to add comment