Jump to content
  • 0
Edeilson X Lorraine

Alguem poderia adptar para frozen

Question

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 @@
+
+
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 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.


.

Share this post


Link to post
Share on other 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

Share this post


Link to post
Share on other 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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...




     



×
×
  • Create New...