Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void joinFight(Player perso, int guid) {
- long timeRestant = Constant.TIME_START_FIGHT - (System.currentTimeMillis() - launchTime);
- Fighter currentJoin = null;
- if (perso.isDead() == 1)
- return;
- if (isBegin())
- return;
- if (perso.getFight() != null)
- return;
- if (perso.getCurMap() != getInit0().getPersonnage().getCurMap() && getType() != Constant.FIGHT_TYPE_PVT && getType() != Constant.FIGHT_TYPE_CONQUETE) {
- Logging.getInstance().write("Anti-cheat", ""+perso.getName()+" a essayer d'utiliser la faille pour rejoindre un combat");
- perso.getAccount().addWarning(1);
- return;
- }
- if (getTeam0().containsKey(guid)) {
- GameCase cell = getRandomCell(getStart0());
- if (cell == null)
- return;
- if (getType() == Constant.FIGHT_TYPE_AGRESSION || this.getType() == Constant.FIGHT_TYPE_PVT) {
- boolean multiIp = false;
- for (Fighter f : getTeam0().values())
- if (perso.getAccount().getCurrentIp().compareTo(f.getPersonnage().getAccount().getCurrentIp()) == 0)
- multiIp = true;
- if (multiIp) {
- SocketManager.GAME_SEND_MESSAGE(perso, "Impossible de rejoindre ce combat, vous êtes déjà dans le combat avec une même IP !");
- return;
- }
- }
- if (isOnlyGroup0()) {
- Party g = getInit0().getPersonnage().getParty();
- if (g != null) {
- if (!g.getPlayers().contains(perso)) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
- return;
- }
- }
- }
- if (getType() == Constant.FIGHT_TYPE_AGRESSION) {
- if (perso.get_align() == Constant.ALIGNEMENT_NEUTRE) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
- return;
- }
- if (getInit0().getPersonnage().get_align() != perso.get_align()) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
- return;
- }
- }
- if (getType() == Constant.FIGHT_TYPE_CONQUETE) {
- if (perso.get_align() == Constant.ALIGNEMENT_NEUTRE) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'a', guid);
- return;
- }
- if (getInit0().getPrism().getAlignement() != perso.get_align()) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'a', guid);
- return;
- }
- perso.toggleWings('+');
- }
- if (getGuildId() > -1 && perso.get_guild() != null) {
- if (getGuildId() == perso.get_guild().getId()) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
- return;
- }
- }
- if (isLocked0()) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
- return;
- }
- if (this.getTeam0().size() >= 8 || this.start0.size() == this.getTeam0().size())
- return;
- if (getType() == Constant.FIGHT_TYPE_CHALLENGE)
- SocketManager.GAME_SEND_GJK_PACKET(perso, 2, 1, 1, 0, timeRestant, getType());
- else
- SocketManager.GAME_SEND_GJK_PACKET(perso, 2, 0, 1, 0, timeRestant, getType());
- SocketManager.GAME_SEND_FIGHT_PLACES_PACKET(perso.getGameClient(), getMap().getPlaces(), getSt1());
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 3, 950, perso.getId() + "", perso.getId() + "," + Constant.ETAT_PORTE + ",0");
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 3, 950, perso.getId() + "", perso.getId() + "," + Constant.ETAT_PORTEUR + ",0");
- SocketManager.GAME_SEND_ERASE_ON_MAP_TO_MAP(perso.getCurMap(), perso.getId());
- SocketManager.GAME_SEND_GDF_PACKET_TO_FIGHT(perso, this.getMap().getCases());
- Fighter f = new Fighter(this, perso);
- currentJoin = f;
- f.setTeam(0);
- getTeam0().put(perso.getId(), f);
- perso.setFight(this);
- f.setCell(cell);
- f.getCell().addFighter(f);
- } else if (getTeam1().containsKey(guid)) {
- GameCase cell = getRandomCell(getStart1());
- if (cell == null)
- return;
- if (getType() == Constant.FIGHT_TYPE_AGRESSION) {
- boolean multiIp = false;
- for (Fighter f : getTeam1().values())
- if (perso.getAccount().getCurrentIp().compareTo(f.getPersonnage().getAccount().getCurrentIp()) == 0)
- multiIp = true;
- if (multiIp) {
- SocketManager.GAME_SEND_MESSAGE(perso, "Impossible de rejoindre ce combat, vous êtes déjà dans le combat avec une même IP !");
- return;
- }
- }
- if (isOnlyGroup1()) {
- Party g = getInit1().getPersonnage().getParty();
- if (g != null) {
- if (!g.getPlayers().contains(perso)) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
- return;
- }
- }
- }
- if (getType() == Constant.FIGHT_TYPE_AGRESSION) {
- if (perso.get_align() == Constant.ALIGNEMENT_NEUTRE) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
- return;
- }
- if (getInit1().getPersonnage().get_align() != perso.get_align()) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
- return;
- }
- }
- if (getType() == Constant.FIGHT_TYPE_CONQUETE) {
- if (perso.get_align() == Constant.ALIGNEMENT_NEUTRE) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'a', guid);
- return;
- }
- if (getInit1().getPrism().getAlignement() != perso.get_align()) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'a', guid);
- return;
- }
- perso.toggleWings('+');
- }
- if (getGuildId() > -1 && perso.get_guild() != null) {
- if (getGuildId() == perso.get_guild().getId()) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
- return;
- }
- }
- if (isLocked1()) {
- SocketManager.GAME_SEND_GA903_ERROR_PACKET(perso.getGameClient(), 'f', guid);
- return;
- }
- if (this.getTeam1().size() >= 8 || this.start1.size() == this.getTeam0().size())
- return;
- if (getType() == Constant.FIGHT_TYPE_CHALLENGE)
- SocketManager.GAME_SEND_GJK_PACKET(perso, 2, 1, 1, 0, 0, getType());
- else
- SocketManager.GAME_SEND_GJK_PACKET(perso, 2, 0, 1, 0, 0, getType());
- SocketManager.GAME_SEND_FIGHT_PLACES_PACKET(perso.getGameClient(), getMap().getPlaces(), getSt2());
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 3, 950, perso.getId() + "", perso.getId() + "," + Constant.ETAT_PORTE + ",0");
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 3, 950, perso.getId() + "", perso.getId() + "," + Constant.ETAT_PORTEUR + ",0");
- SocketManager.GAME_SEND_ERASE_ON_MAP_TO_MAP(perso.getCurMap(), perso.getId());
- Fighter f = new Fighter(this, perso);
- currentJoin = f;
- f.setTeam(1);
- getTeam1().put(perso.getId(), f);
- perso.setFight(this);
- f.setCell(cell);
- f.getCell().addFighter(f);
- }
- demorph(perso);
- if(currentJoin == null) return;
- perso.getCurCell().removePlayer(perso);
- SocketManager.GAME_SEND_ADD_IN_TEAM_PACKET_TO_MAP(perso.getCurMap(), (currentJoin.getTeam() == 0 ? getInit0() : getInit1()).getId(), currentJoin);
- SocketManager.GAME_SEND_FIGHT_PLAYER_JOIN(this, 7, currentJoin);
- SocketManager.GAME_SEND_MAP_FIGHT_GMS_PACKETS(this, getMap(), perso);
- if (getCollector() != null) {
- World.world.getGuild(getGuildId()).getMembers().stream().filter(Player::isOnline).forEach(z -> {
- Collector.parseAttaque(z, getGuildId());
- Collector.parseDefense(z, getGuildId());
- });
- }
- if (getPrism() != null)
- World.world.getOnlinePlayers().stream().filter(Objects::nonNull).filter(z -> z.get_align() == getPrism().getAlignement()).forEach(z -> Prism.parseAttack(perso));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement