/**
* @author Mobius (based on Tenkai pvpzone)
*/
public class FindPvP implements IBypassHandler
{
private static final String[] COMMANDS =
{
"FindPvP"
};
@Override
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!Config.ENABLE_FIND_PVP || !target.isNpc())
{
return false;
}
L2PcInstance mostPvP = null;
int max = -1;
for (L2PcInstance player : L2World.getInstance().getPlayers())
{
if ((player == null) //
|| (player.getPvpFlag() == 0) //
|| (player.getInstanceId() != 0) //
|| player.isGM() //
|| player.isInsideZone(ZoneId.PEACE) //
|| player.isInsideZone(ZoneId.SIEGE) //
|| player.isInsideZone(ZoneId.NO_SUMMON_FRIEND))
{
continue;
}
int count = 0;
for (L2PcInstance pl : L2World.getInstance().getVisibleObjects(player, L2PcInstance.class))
{
if ((pl.getPvpFlag() > 0) && !pl.isInsideZone(ZoneId.PEACE))
{
count++;
}
}
if (count > max)
{
max = count;
mostPvP = player;
}
}
if (mostPvP != null)
{
// Check if the player's clan is already outnumbering the PvP
if (activeChar.getClan() != null)
{
Map<Integer, Integer> clanNumbers = new HashMap<>();
int allyId = activeChar.getAllyId();
if (allyId == 0)
{
allyId = activeChar.getClanId();
}
clanNumbers.put(allyId, 1);
for (L2PcInstance known : L2World.getInstance().getVisibleObjects(mostPvP, L2PcInstance.class))
{
int knownAllyId = known.getAllyId();
if (knownAllyId == 0)
{
knownAllyId = known.getClanId();
}
if (knownAllyId != 0)
{
if (clanNumbers.containsKey(knownAllyId))
{
clanNumbers.put(knownAllyId, clanNumbers.get(knownAllyId) + 1);
}
else
{
clanNumbers.put(knownAllyId, 1);
}
}
}
int biggestAllyId = 0;
int biggestAmount = 2;
for (Entry<Integer, Integer> clanNumber : clanNumbers.entrySet())
{
if (clanNumber.getValue() > biggestAmount)
{
biggestAllyId = clanNumber.getKey();
biggestAmount = clanNumber.getValue();
}
}
if (biggestAllyId == allyId)
{
activeChar.sendPacket(new CreatureSay(0, ChatType.WHISPER, target.getName(), "Sorry, your clan/ally is outnumbering the place already so you can't move there."));
return true;
}
}
activeChar.teleToLocation((mostPvP.getX() + Rnd.get(300)) - 150, (mostPvP.getY() + Rnd.get(300)) - 150, mostPvP.getZ());
activeChar.setSpawnProtection(true);
if (!activeChar.isGM())
{
activeChar.setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_PVP_TIME);
activeChar.startPvPFlag();
}
}
else
{
activeChar.sendPacket(new CreatureSay(0, ChatType.WHISPER, target.getName(), "Sorry, I can't find anyone in flag status right now."));
}
return false;
}
@Override
public String[] getBypassList()
{
return COMMANDS;
}
}
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.
Hello , i have an issue with the pet commands. I am using acis latest public version.
When i am using the attack command on a monster , it does it but when i press stop, it doesnt stop. After i spam like 3-4 times the change position it works. No errors also in the console...anyone knows whats going on?
Hey guys, I'm setting up a L2OFF Classic server.
The physical server is in the United States. Here I have the AuthdClassic and L2Server.
IP 77.77.77.77
And I have two additional private servers that I want to use as proxies for people in Europe and South America.
Europe IP 88.88.88.88
Brazil: 99.99.99.99
My idea is to have only one server, but that when logging in, those from North America can log in to the US server.
Those from Europe can log in to the EUR server.
And those from South America can log in to the BR server.
But at the same time, everyone can be seen in-game...
I know this is done with a proxy, but I don't know how.
In my AuthMod.ini file I have this configured... now... what should I do on the EU and BR servers?
[Setting]
Enabled=1
ServerListSize=3
;Time in seconds for checking proxies status - 0 means disabled, they'll remain as online
ProxyCheckInterval=10
;Timeout in seconds during Port Check
ProxyCheckTimeout=15
[Server_1]
Name=EU1
;Proxy or real ip that will redirect packets to L2Server (player<>l2server connection)
ServerIp=127.0.0.1
;ServerIp=77.77.77.77
;Proxy or real server port
ServerPort=7777
;Server id used in ServerList packet - id of the server from servername-e.dat
ServerId=1
;Real server id - the one specified in l2server.ini
RealServerId=1
;PvP server flag
PvPServer=1
;Test server flag
TestServer=0
;Show clock in server status
ShowClock=0
;Age limit
AgeLimit=0
;Show brackets [] before server name
ShowBrackets=0
;Server Type 1: Normal, 2: Classic
ServerType=2
;Fake Online Status 1: Light , 2: Normal, 3: Heavy
FakeEngine=2
[Server_2]
Name=EUR
;Proxy or real ip that will redirect packets to L2Server (player<>l2server connection)
ServerIp=127.0.0.1
;ServerIp=88.88.88.88
;Proxy or real server port
ServerPort=7777
;Server id used in ServerList packet - id of the server from servername-e.dat
ServerId=2
;Real server id - the one specified in l2server.ini
RealServerId=1
;PvP server flag
PvPServer=1
;Test server flag
TestServer=0
;Show clock in server status
ShowClock=0
;Age limit
AgeLimit=0
;Show brackets [] before server name
ShowBrackets=0
;Server Type 1: Normal, 2: Classic
ServerType=2
;Fake Online Status 1: Light , 2: Normal, 3: Heavy
FakeEngine=2
[Server_3]
Name=BR
;Proxy or real ip that will redirect packets to L2Server (player<>l2server connection)
ServerIp=127.0.0.1
;ServerIp=99.99.99.99
;Proxy or real server port
ServerPort=7777
;Server id used in ServerList packet - id of the server from servername-e.dat
ServerId=3
;Real server id - the one specified in l2server.ini
RealServerId=1
;PvP server flag
PvPServer=1
;Test server flag
TestServer=0
;Show clock in server status
ShowClock=0
;Age limit
AgeLimit=0
;Show brackets [] before server name
ShowBrackets=0
;Server Type 1: Normal, 2: Classic
ServerType=2
;Fake Online Status 1: Light , 2: Normal, 3: Heavy
FakeEngine=2
Question
lazzytr
I use l2fandc files. I need a java code, I've been searching a lot and waiting for help.
What I want to do is to teleport to the players doing pvp. So it's like finding the flag player.
I found some files but they did not fit my system. I'm waiting for help..
EXAMPLE:
package handlers.bypasshandlers;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.handler.IBypassHandler;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
/**
* @author Mobius (based on Tenkai pvpzone)
*/
public class FindPvP implements IBypassHandler
{
private static final String[] COMMANDS =
{
"FindPvP"
};
@Override
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!Config.ENABLE_FIND_PVP || !target.isNpc())
{
return false;
}
L2PcInstance mostPvP = null;
int max = -1;
for (L2PcInstance player : L2World.getInstance().getPlayers())
{
if ((player == null) //
|| (player.getPvpFlag() == 0) //
|| (player.getInstanceId() != 0) //
|| player.isGM() //
|| player.isInsideZone(ZoneId.PEACE) //
|| player.isInsideZone(ZoneId.SIEGE) //
|| player.isInsideZone(ZoneId.NO_SUMMON_FRIEND))
{
continue;
}
int count = 0;
for (L2PcInstance pl : L2World.getInstance().getVisibleObjects(player, L2PcInstance.class))
{
if ((pl.getPvpFlag() > 0) && !pl.isInsideZone(ZoneId.PEACE))
{
count++;
}
}
if (count > max)
{
max = count;
mostPvP = player;
}
}
if (mostPvP != null)
{
// Check if the player's clan is already outnumbering the PvP
if (activeChar.getClan() != null)
{
Map<Integer, Integer> clanNumbers = new HashMap<>();
int allyId = activeChar.getAllyId();
if (allyId == 0)
{
allyId = activeChar.getClanId();
}
clanNumbers.put(allyId, 1);
for (L2PcInstance known : L2World.getInstance().getVisibleObjects(mostPvP, L2PcInstance.class))
{
int knownAllyId = known.getAllyId();
if (knownAllyId == 0)
{
knownAllyId = known.getClanId();
}
if (knownAllyId != 0)
{
if (clanNumbers.containsKey(knownAllyId))
{
clanNumbers.put(knownAllyId, clanNumbers.get(knownAllyId) + 1);
}
else
{
clanNumbers.put(knownAllyId, 1);
}
}
}
int biggestAllyId = 0;
int biggestAmount = 2;
for (Entry<Integer, Integer> clanNumber : clanNumbers.entrySet())
{
if (clanNumber.getValue() > biggestAmount)
{
biggestAllyId = clanNumber.getKey();
biggestAmount = clanNumber.getValue();
}
}
if (biggestAllyId == allyId)
{
activeChar.sendPacket(new CreatureSay(0, ChatType.WHISPER, target.getName(), "Sorry, your clan/ally is outnumbering the place already so you can't move there."));
return true;
}
}
activeChar.teleToLocation((mostPvP.getX() + Rnd.get(300)) - 150, (mostPvP.getY() + Rnd.get(300)) - 150, mostPvP.getZ());
activeChar.setSpawnProtection(true);
if (!activeChar.isGM())
{
activeChar.setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_PVP_TIME);
activeChar.startPvPFlag();
}
}
else
{
activeChar.sendPacket(new CreatureSay(0, ChatType.WHISPER, target.getName(), "Sorry, I can't find anyone in flag status right now."));
}
return false;
}
@Override
public String[] getBypassList()
{
return COMMANDS;
}
}
2 answers to this question
Recommended Posts
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.