falyptus

Action ID -1

Jul 5th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. case -1://Ouvrir banque
  2.                 //Sauvagarde du perso et des item avant.       
  3.                 SQLManager.SAVE_PERSONNAGE(perso,true);
  4.                 if(perso.getDeshonor() >= 1)
  5.                 {
  6.                     SocketManager.GAME_SEND_Im_PACKET(perso, "183");
  7.                     return;
  8.                 }
  9.                 final int cost = perso.get_compte().getBankCost();
  10.                 if(cost > 0)
  11.                 {
  12.  
  13.                     final long playerKamas = perso.get_kamas();
  14.                     final long kamasRemaining = playerKamas - cost;
  15.                     final long bankKamas = perso.get_compte().GetBankKamas();
  16.                     final long totalKamas = bankKamas+playerKamas;
  17.  
  18.                     if (kamasRemaining < 0)//Si le joueur n'a pas assez de kamas SUR LUI pour ouvrir la banque
  19.                     {
  20.                         if(bankKamas >= cost)
  21.                         {
  22.                             perso.setBankKamas(bankKamas-cost); //On modifie les kamas de la banque
  23.                         }
  24.                         else if(totalKamas >= cost)
  25.                         {
  26.                             perso.set_kamas( 0 ); //On puise l'entièreter des kamas du joueurs. Ankalike ?
  27.                             perso.setBankKamas(totalKamas-cost); //On modifie les kamas de la banque
  28.                             SocketManager.GAME_SEND_STATS_PACKET(perso);
  29.                             SocketManager.GAME_SEND_Im_PACKET(perso, "020;"+playerKamas);
  30.                         }else
  31.                         {
  32.                             SocketManager.GAME_SEND_MESSAGE_SERVER(perso, "10|"+cost);
  33.                             return;
  34.                         }
  35.                     } else //Si le joueur a les kamas sur lui on lui retire directement
  36.                     {
  37.                         perso.set_kamas(kamasRemaining);
  38.                         SocketManager.GAME_SEND_STATS_PACKET(perso);
  39.                         SocketManager.GAME_SEND_Im_PACKET(perso, "020;"+cost);
  40.                     }
  41.                 }
  42.                 SocketManager.GAME_SEND_ECK_PACKET(perso.get_compte().getGameThread().get_out(), 5, "");
  43.                 SocketManager.GAME_SEND_EL_BANK_PACKET(perso);
  44.                 perso.set_away(true);
  45.                 perso.setInBank(true);
  46.                 break;
Advertisement
Add Comment
Please, Sign In to add comment