Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.21 KB | None | 0 0
  1. public void joinFight(Player perso, int guid) {
  2. long timeRestant = Constant.TIME_START_FIGHT - (System.currentTimeMillis() - launchTime);
  3. Fighter currentJoin = null;
  4.  
  5. if (perso.isDead() == 1)
  6. return;
  7. if (isBegin())
  8. return;
  9. if (perso.getFight() != null)
  10. return;
  11. if (perso.getCurMap() != getInit0().getPersonnage().getCurMap() && getType() != Constant.FIGHT_TYPE_PVT && getType() != Constant.FIGHT_TYPE_CONQUETE) {
  12. Logging.getInstance().write("Anti-cheat", ""+perso.getName()+" a essayer d'utiliser la faille pour rejoindre un combat");
  13. perso.getAccount().addWarning(1);
  14. return;
  15. }
  16. if (getTeam0().containsKey(guid)) {
  17. GameCase cell = getRandomCell(getStart0());
  18. if (cell == null)
  19. return;
  20. if (getType() == Constant.FIGHT_TYPE_AGRESSION || this.getType() == Constant.FIGHT_TYPE_PVT) {
  21. boolean multiIp = false;
  22. for (Fighter f : getTeam0().values())
  23. if (perso.getAccount().getCurrentIp().compareTo(f.getPersonnage().getAccount().getCurrentIp()) == 0)
  24. multiIp = true;
  25. if (multiIp) {
  26. SocketManager.GAME_SEND_MESSAGE(perso, "Impossible de rejoindre ce combat, vous êtes déjà dans le combat avec une même IP !");
  27. return;
  28. }
  29. }
  30. if (isOnlyGroup0()) {
  31. Party g = getInit0().getPersonnage().getParty();
  32. if (g != null) {
  33. if (!g.getPlayers().contains(perso)) {
  34. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
  35. return;
  36. }
  37. }
  38. }
  39. if (getType() == Constant.FIGHT_TYPE_AGRESSION) {
  40. if (perso.get_align() == Constant.ALIGNEMENT_NEUTRE) {
  41. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
  42. return;
  43. }
  44. if (getInit0().getPersonnage().get_align() != perso.get_align()) {
  45. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
  46. return;
  47. }
  48. }
  49. if (getType() == Constant.FIGHT_TYPE_CONQUETE) {
  50. if (perso.get_align() == Constant.ALIGNEMENT_NEUTRE) {
  51. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'a', guid);
  52. return;
  53. }
  54. if (getInit0().getPrism().getAlignement() != perso.get_align()) {
  55. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'a', guid);
  56. return;
  57. }
  58. perso.toggleWings('+');
  59. }
  60. if (getGuildId() > -1 && perso.get_guild() != null) {
  61. if (getGuildId() == perso.get_guild().getId()) {
  62. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
  63. return;
  64. }
  65. }
  66. if (isLocked0()) {
  67. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
  68. return;
  69. }
  70.  
  71. if (this.getTeam0().size() >= 8 || this.start0.size() == this.getTeam0().size())
  72. return;
  73. if (getType() == Constant.FIGHT_TYPE_CHALLENGE)
  74. SocketManager.GAME_SEND_GJK_PACKET(perso, 2, 1, 1, 0, timeRestant, getType());
  75. else
  76. SocketManager.GAME_SEND_GJK_PACKET(perso, 2, 0, 1, 0, timeRestant, getType());
  77.  
  78. SocketManager.GAME_SEND_FIGHT_PLACES_PACKET(perso.getGameClient(), getMap().getPlaces(), getSt1());
  79. SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 3, 950, perso.getId() + "", perso.getId() + "," + Constant.ETAT_PORTE + ",0");
  80. SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 3, 950, perso.getId() + "", perso.getId() + "," + Constant.ETAT_PORTEUR + ",0");
  81. SocketManager.GAME_SEND_ERASE_ON_MAP_TO_MAP(perso.getCurMap(), perso.getId());
  82. SocketManager.GAME_SEND_GDF_PACKET_TO_FIGHT(perso, this.getMap().getCases());
  83. Fighter f = new Fighter(this, perso);
  84. currentJoin = f;
  85. f.setTeam(0);
  86. getTeam0().put(perso.getId(), f);
  87. perso.setFight(this);
  88. f.setCell(cell);
  89. f.getCell().addFighter(f);
  90. } else if (getTeam1().containsKey(guid)) {
  91. GameCase cell = getRandomCell(getStart1());
  92. if (cell == null)
  93. return;
  94. if (getType() == Constant.FIGHT_TYPE_AGRESSION) {
  95. boolean multiIp = false;
  96. for (Fighter f : getTeam1().values())
  97. if (perso.getAccount().getCurrentIp().compareTo(f.getPersonnage().getAccount().getCurrentIp()) == 0)
  98. multiIp = true;
  99. if (multiIp) {
  100. SocketManager.GAME_SEND_MESSAGE(perso, "Impossible de rejoindre ce combat, vous êtes déjà dans le combat avec une même IP !");
  101. return;
  102. }
  103. }
  104. if (isOnlyGroup1()) {
  105. Party g = getInit1().getPersonnage().getParty();
  106. if (g != null) {
  107. if (!g.getPlayers().contains(perso)) {
  108. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
  109. return;
  110. }
  111. }
  112. }
  113. if (getType() == Constant.FIGHT_TYPE_AGRESSION) {
  114. if (perso.get_align() == Constant.ALIGNEMENT_NEUTRE) {
  115. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
  116. return;
  117. }
  118. if (getInit1().getPersonnage().get_align() != perso.get_align()) {
  119. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
  120. return;
  121. }
  122. }
  123. if (getType() == Constant.FIGHT_TYPE_CONQUETE) {
  124. if (perso.get_align() == Constant.ALIGNEMENT_NEUTRE) {
  125. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'a', guid);
  126. return;
  127. }
  128. if (getInit1().getPrism().getAlignement() != perso.get_align()) {
  129. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'a', guid);
  130. return;
  131. }
  132. perso.toggleWings('+');
  133. }
  134. if (getGuildId() > -1 && perso.get_guild() != null) {
  135. if (getGuildId() == perso.get_guild().getId()) {
  136. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
  137. return;
  138. }
  139. }
  140. if (isLocked1()) {
  141. SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
  142. return;
  143. }
  144. if (this.getTeam1().size() >= 8 || this.start1.size() == this.getTeam0().size())
  145. return;
  146. if (getType() == Constant.FIGHT_TYPE_CHALLENGE)
  147. SocketManager.GAME_SEND_GJK_PACKET(perso, 2, 1, 1, 0, 0, getType());
  148. else
  149. SocketManager.GAME_SEND_GJK_PACKET(perso, 2, 0, 1, 0, 0, getType());
  150.  
  151. SocketManager.GAME_SEND_FIGHT_PLACES_PACKET(perso.getGameClient(), getMap().getPlaces(), getSt2());
  152. SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 3, 950, perso.getId() + "", perso.getId() + "," + Constant.ETAT_PORTE + ",0");
  153. SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 3, 950, perso.getId() + "", perso.getId() + "," + Constant.ETAT_PORTEUR + ",0");
  154. SocketManager.GAME_SEND_ERASE_ON_MAP_TO_MAP(perso.getCurMap(), perso.getId());
  155.  
  156. Fighter f = new Fighter(this, perso);
  157. currentJoin = f;
  158. f.setTeam(1);
  159. getTeam1().put(perso.getId(), f);
  160. perso.setFight(this);
  161. f.setCell(cell);
  162. f.getCell().addFighter(f);
  163. }
  164.  
  165. demorph(perso);
  166.  
  167. if(currentJoin == null) return;
  168. perso.getCurCell().removePlayer(perso);
  169.  
  170. SocketManager.GAME_SEND_ADD_IN_TEAM_PACKET_TO_MAP(perso.getCurMap(), (currentJoin.getTeam() == 0 ? getInit0() : getInit1()).getId(), currentJoin);
  171. SocketManager.GAME_SEND_FIGHT_PLAYER_JOIN(this, 7, currentJoin);
  172. SocketManager.GAME_SEND_MAP_FIGHT_GMS_PACKETS(this, getMap(), perso);
  173.  
  174. if (getCollector() != null) {
  175. World.world.getGuild(getGuildId()).getMembers().stream().filter(Player::isOnline).forEach(z -> {
  176. Collector.parseAttaque(z, getGuildId());
  177. Collector.parseDefense(z, getGuildId());
  178. });
  179. }
  180. if (getPrism() != null)
  181. World.world.getOnlinePlayers().stream().filter(Objects::nonNull).filter(z -> z.get_align() == getPrism().getAlignement()).forEach(z -> Prism.parseAttack(perso));
  182. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement