SHOW:
|
|
- or go back to the newest paste.
| 1 | case -1://Ouvrir banque | |
| 2 | - | //Sauvagarde du perso et des item avant. |
| 2 | + | //Sauvagarde du perso et des item avant. |
| 3 | SQLManager.SAVE_PERSONNAGE(perso,true); | |
| 4 | - | if(perso.getDeshonor() >= 1) |
| 4 | + | if(perso.getDeshonor() >= 1) |
| 5 | {
| |
| 6 | SocketManager.GAME_SEND_Im_PACKET(perso, "183"); | |
| 7 | return; | |
| 8 | } | |
| 9 | - | int cost = perso.getBankCost(); |
| 9 | + | final int cost = perso.get_compte().getBankCost(); |
| 10 | if(cost > 0) | |
| 11 | {
| |
| 12 | - | long nKamas = perso.get_kamas() - cost; |
| 12 | + | |
| 13 | - | |
| 13 | + | final long playerKamas = perso.get_kamas(); |
| 14 | - | if (nKamas < 0)//Si le joueur n'a pas assez de kamas pour ouvrir la banque |
| 14 | + | final long kamasRemaining = playerKamas - cost; |
| 15 | final long bankKamas = perso.get_compte().GetBankKamas(); | |
| 16 | - | long bankKamas = perso.getBankKamas(); |
| 16 | + | final long totalKamas = bankKamas+playerKamas; |
| 17 | - | if(bankKamas >= nKamas) |
| 17 | + | |
| 18 | - | {
|
| 18 | + | if (kamasRemaining < 0)//Si le joueur n'a pas assez de kamas SUR LUI pour ouvrir la banque |
| 19 | - | perso.set_kamas( 0 ); //On puise l'entièreter des kamas du joueurs. Ankalike ? |
| 19 | + | |
| 20 | - | perso.setBankKamas(bankKamas-nKamas); //On modifie les kamas de la banque |
| 20 | + | if(bankKamas >= cost) |
| 21 | - | nKamas = 0; //How todo more crap? xd |
| 21 | + | {
|
| 22 | - | }else |
| 22 | + | perso.setBankKamas(bankKamas-cost); //On modifie les kamas de la banque |
| 23 | - | {
|
| 23 | + | } |
| 24 | - | SocketManager.GAME_SEND_MESSAGE_SERVER(perso, "10|"+cost); |
| 24 | + | else if(totalKamas >= cost) |
| 25 | - | return; |
| 25 | + | {
|
| 26 | - | } |
| 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 | - | perso.set_kamas(nKamas); |
| 28 | + | SocketManager.GAME_SEND_STATS_PACKET(perso); |
| 29 | - | SocketManager.GAME_SEND_STATS_PACKET(perso); |
| 29 | + | SocketManager.GAME_SEND_Im_PACKET(perso, "020;"+playerKamas); |
| 30 | - | SocketManager.GAME_SEND_Im_PACKET(perso, "020;"+cost); |
| 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 | - | break; |
| 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; |