Secret Experience

Secret Experience (https://secretexperience.net/)
-   [Lineage] Java Mods (https://secretexperience.net/lineage-java-mods/)
-   -   [L2JServer] PvP Pontos - Protecoes (https://secretexperience.net/lineage-java-mods/26541-pvp-pontos-protecoes.html)

.Over12 14-10-2010 05:17 PM

PvP Pontos - Protecoes
 
Olá galera, to postando aqui uma protecao simples para os PvPs.
Caso a pessoa esteja querendo ganhar Pontos de PvP , nas custas de Dual box, não vai ganhar.


Procura essa linha:
public void increasePvpKills(L2Character target)
E substitui ela por essa : abaixo.

Código:

public void increasePvpKills(L2Character target)
        {
if (target instanceof L2PcInstance
                                && AntiFeedManager.getInstance().check(this, target))
                {
                //Protecao para Personagens do level 40 menos
        if(target.getLevel() < 40) //Checa o Char que ta com o Level menor
        {
        this.sendMessage("Personagem esta Level baixo ");
        _log.warning("ATENCAO PvP BLOQUIADO: " + this.getName() + " e" + target.getName() +". Personagem NewBie.");
        return;
        }
        else { // Se o char tiver o Level maior passa pra linha abaixo.
                // Add Karma ao Player caso nao retorne o Ataque.
                        setPvpKills(getPvpKills() + 1); // Ganha mais um P. de Pk

                        // Envia a Informacao de PK do char em suas INFO
                        sendPacket(new UserInfo(this));
                        sendPacket(new ExBrExtraUserInfo(this));
        }

//Protecao para PvP de Party 
        if(this.getParty() != null && target.getParty() != null)
        {
          if(this.getParty().equals(target.getParty())) // Se o Target tiver na party
          {
          this.sendMessage("Personagem na mesma party."); 
          _log.warning("ATENCAO PvP BLOQUIADO: " + this.getName() + " e" + target.getName() +". PARTY.");
          return;
          }
       
        }
 else { // Se o char tiver na party passa pra linha abaixo.
                // Add Karma ao Player caso nao retorne o Ataque.
                        setPvpKills(getPvpKills() + 1); // Ganha mais um P. de Pk

                        // Envia a Informacao de PK do char em suas INFO
                        sendPacket(new UserInfo(this));
                        sendPacket(new ExBrExtraUserInfo(this));
        }

 
        //Protecao para o mesmo IP
//Checar o IP do Player

        String ip1 = this.getClient().getConnection().getInetAddress().getHostAddress();
//Checa o IP do segundo Player, variavel IP2, temporaria
        String ip2 = getClient().getConnection().getInetAddress().getHostAddress();

//Checa a comparacao dos Ips se Ip for igual o IP2
        if (ip1.equals(ip2))
        {
        this.sendMessage("Personagem no mesmo IP ");
        _log.warning("ATENCAO PvP BLOQUIADO: " + this.getName() + " e " + target.getName() +". MESMO IP.");
        return;
        }
else {  // Se o char tiver no mesmo ip passa pra linha abaixo.
                // Add Karma ao Player caso nao retorne o Ataque.
                        setPvpKills(getPvpKills() + 1); // Ganha mais um P. de Pk

                        // Envia a Informacao de PK do char em suas INFO
                        sendPacket(new UserInfo(this));
                        sendPacket(new ExBrExtraUserInfo(this));
        }
}

e o codigo termina acima desse aqui:
/**
* Increase pk count, karma and send the info to the player


Não cheguei a testar por que meu Pc não abre 2 Janelas, quem tiver um pc melhor que o meu testa e me fala qualquer coisa me reporta que corrijo algo se estiver errado , mas creio que estará tudo Ok.

Obs: Deixei as linhas com comentários para um fácil entendimento e assim , começar a estimular a cabecinha de vocês a entenderem os Códigos de seu servidor.


Creditos For me.

pieri 14-12-2010 03:53 PM

onde fica essa linha? qual o index?

public void increasePvpKills(L2Character target)

.Over12 14-12-2010 04:45 PM

L2PcIstance


Horários baseados na GMT -3. Agora são 05:32 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0