Guest User

Untitled

a guest
Jul 23rd, 2019
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. #region
  2. using Plus.Communication.Packets.Outgoing.Inventory.Purse;
  3. using Plus.HabboHotel.GameClients;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. #endregion
  10.  
  11. namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
  12. {
  13. internal class PayCommand : IChatCommand
  14. {
  15. public string PermissionRequired => "command_pay";
  16.  
  17. public string Parameters => "%username% & %type% & %id%";
  18.  
  19. public string Description => "Enviar a um amigo créditos ou diamantes.";
  20.  
  21. public void Execute(GameClient Session, Room Room, string[] Params)
  22. {
  23. if (Params.Length == 1)
  24. {
  25. Session.SendWhisper("Oops, você deve digitar o nick do usuário!");
  26. return;
  27. }
  28.  
  29. if (Params.Length == 2)
  30. {
  31. Session.SendWhisper("Oops, você esqueceu-se de especificar qual é a moeda. (credits/diamonds)");
  32. return;
  33. }
  34.  
  35. if (Params.Length == 3)
  36. {
  37. Session.SendWhisper("Oops, você esqueceu-se de especificar a quantidade que deseja enviar.");
  38. return;
  39. }
  40. else if (Params[3].Contains("-"))
  41. {
  42. Session.SendWhisper("Oops, você não pode colocar isso! (E:3)");
  43. return;
  44. }
  45.  
  46. GameClient TargetClient = null;
  47. TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
  48.  
  49. if (TargetClient == null)
  50. {
  51. Session.SendWhisper("Oops, o usuário não encontra-se online!");
  52. return;
  53. }
  54.  
  55. if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)
  56. {
  57. Session.SendWhisper("Oops, você não pode executar esse comando em si mesmo!");
  58. return;
  59. }
  60.  
  61. int Amount = Convert.ToInt32(Params[3]);
  62.  
  63. var Options = Params[2];
  64. switch (Options.ToLower())
  65. {
  66. case "credits":
  67. case "moedas":
  68. {
  69. if (Session.GetHabbo().Credits < Amount)
  70. {
  71. Session.SendWhisper("Oops, você não tem créditos suficientes! (E:1)");
  72. return;
  73. }
  74.  
  75. if (Amount > Session.GetHabbo().Credits)
  76. {
  77. Session.SendWhisper("Oops, você não tem créditos suficientes! (E:2)");
  78. return;
  79. }
  80.  
  81. Session.GetHabbo().Credits -= Amount;
  82. Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
  83.  
  84. TargetClient.GetHabbo().Credits += Amount;
  85. TargetClient.SendMessage(new CreditBalanceComposer(TargetClient.GetHabbo().Credits));
  86.  
  87. Session.SendWhisper("Enviou com sucesso " + Amount + " créditos de sua conta para a conta de " + TargetClient.GetHabbo().Username + " !");
  88. TargetClient.SendWhisper("Recebeu com sucesso do usuário " + Session.GetHabbo().Username + " " + Amount + " créditos!");
  89. break;
  90. }
  91. case "diamonds":
  92. case "diamantes":
  93. {
  94. if (Session.GetHabbo().Diamonds < Amount)
  95. {
  96. Session.SendWhisper("Oops, você não tem diamantes suficientes! (E:1)");
  97. return;
  98. }
  99.  
  100. if (Amount > Session.GetHabbo().Diamonds)
  101. {
  102. Session.SendWhisper("Oops, você não tem diamantes suficientes! (E:2)");
  103. return;
  104. }
  105.  
  106. Session.GetHabbo().Diamonds -= Amount;
  107. Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, -Amount, 5));
  108.  
  109. TargetClient.GetHabbo().Diamonds += Amount;
  110. TargetClient.SendMessage(new HabboActivityPointNotificationComposer(TargetClient.GetHabbo().Diamonds, Amount, 5));
  111.  
  112. Session.SendWhisper("Enviou com sucesso " + Amount + " diamantes de sua conta para a conta de " + TargetClient.GetHabbo().Username + " !");
  113. TargetClient.SendWhisper("Recebeu com sucesso do usuário " + Session.GetHabbo().Username + " " + Amount + " diamantes!");
  114. break;
  115. }
  116. default:
  117. {
  118. Session.SendWhisper("Oops, essa opção não existe! Apenas existe as opções: (credits/diamonds)");
  119. break;
  120. }
  121. }
  122. }
  123. }
  124. }
  125.  
  126. CRÉDITOS:
  127. SNAIKER (POLLAK)
  128. ARQUIVOSHPS
Advertisement
Add Comment
Please, Sign In to add comment