Ir para conteúdo
  • Cadastre-se
  • 0

Alguem poderia adptar para frozen


Edeilson X Lorraine

Pergunta

Mudar area PVP automaticamente

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
package ai.RandomPvpZone;

import ai.AbstractNpcAI;

import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.zone.L2ZoneType;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.util.Rnd;

/**
* @author Ezequiel Adaptacion CaFi
*/
public class RandomPvpZone extends AbstractNpcAI
{
// zonas id
private final int zoneid1 = 100000;
private final int zoneid2 = 100001;
private final int zoneid3 = 100002;
private final int zoneid4 = 100003;

// tiempo de cada zone 30 min
private final int tiempocadazona = 1800000;
private int zonechoose;
private long time;

public RandomPvpZone(String name, String descr)
{
super(name, descr);
// agregamos las zonas
addEnterZoneId(zoneid1, zoneid2, zoneid3, zoneid4);
addExitZoneId(zoneid1, zoneid2, zoneid3, zoneid4);

time = System.currentTimeMillis();

zonechoose = zoneid1;
}

public String onEnterZone(L2PcInstance character, L2ZoneType zone)
{

if (zone.getId() == luckyzone())
{
character.sendPacket(SystemMessageId.ENTERED_COMBAT_ZONE);
character.broadcastUserInfo();
character.updatePvPFlag(1);
}

return super.onEnterZone(character, zone);
}

public String onExitZone(L2PcInstance character, L2ZoneType zone)
{

if (zone.getId() == luckyzone())
{
character.sendPacket(SystemMessageId.LEFT_COMBAT_ZONE);
character.broadcastUserInfo();
character.updatePvPFlag(0);
}

return super.onExitZone(character, zone);

}

private int luckyzone()
{
if (System.currentTimeMillis() > (time + tiempocadazona))
{
// elije una zona random
zonechoose = Rnd.get(zoneid1, zoneid4);
time = System.currentTimeMillis();
}
return zonechoose;
}

public static void main(String[] args)
{
new RandomPvpZone(RandomPvpZone.class.getSimpleName(), "ai/RandomPvpZone");
}
}



--- /dev/null
+++ b/L2J_DataPack/dist/game/data/zones/randompvpzone.xml
@@ -0,0 +1,16 @@
+
+
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts recomendados

  • 0

Isto é um pedido por esse motivo está sendo movido para área de pedidos .

 

Caso necessário faça as edições no título e na descrição de seu tópico para adequar às exigências da comunidade.

Link para o comentário
Compartilhar em outros sites


  • 0
Em 25/04/2019 at 17:12, Edeilson X Lorraine disse:

Mudar area PVP automaticamente

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
package ai.RandomPvpZone;

import ai.AbstractNpcAI;

import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.zone.L2ZoneType;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.util.Rnd;

/**
* @author Ezequiel Adaptacion CaFi
*/
public class RandomPvpZone extends AbstractNpcAI
{
// zonas id
private final int zoneid1 = 100000;
private final int zoneid2 = 100001;
private final int zoneid3 = 100002;
private final int zoneid4 = 100003;

// tiempo de cada zone 30 min
private final int tiempocadazona = 1800000;
private int zonechoose;
private long time;

public RandomPvpZone(String name, String descr)
{
super(name, descr);
// agregamos las zonas
addEnterZoneId(zoneid1, zoneid2, zoneid3, zoneid4);
addExitZoneId(zoneid1, zoneid2, zoneid3, zoneid4);

time = System.currentTimeMillis();

zonechoose = zoneid1;
}

public String onEnterZone(L2PcInstance character, L2ZoneType zone)
{

if (zone.getId() == luckyzone())
{
character.sendPacket(SystemMessageId.ENTERED_COMBAT_ZONE);
character.broadcastUserInfo();
character.updatePvPFlag(1);
}

return super.onEnterZone(character, zone);
}

public String onExitZone(L2PcInstance character, L2ZoneType zone)
{

if (zone.getId() == luckyzone())
{
character.sendPacket(SystemMessageId.LEFT_COMBAT_ZONE);
character.broadcastUserInfo();
character.updatePvPFlag(0);
}

return super.onExitZone(character, zone);

}

private int luckyzone()
{
if (System.currentTimeMillis() > (time + tiempocadazona))
{
// elije una zona random
zonechoose = Rnd.get(zoneid1, zoneid4);
time = System.currentTimeMillis();
}
return zonechoose;
}

public static void main(String[] args)
{
new RandomPvpZone(RandomPvpZone.class.getSimpleName(), "ai/RandomPvpZone");
}
}



--- /dev/null
+++ b/L2J_DataPack/dist/game/data/zones/randompvpzone.xml
@@ -0,0 +1,16 @@
+
+
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+

Manda o link de onde conseguiu

Link para o comentário
Compartilhar em outros sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Processando...
  • Registre-se

    Faça parte da maior e  mais antigas comunidades sobre Lineage2 da América Latina.





×
×
  • Criar Novo...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.