Merged FindPvP search method to useBypass.

This commit is contained in:
MobiusDev 2017-09-14 17:09:26 +00:00
parent 92384cfcba
commit 6cb9a64ac0
5 changed files with 155 additions and 185 deletions

View File

@ -48,7 +48,37 @@ public class FindPvP implements IBypassHandler
return false; return false;
} }
final L2PcInstance mostPvP = getMostPvP(); 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) if (mostPvP != null)
{ {
// Check if the player's clan is already outnumbering the PvP // Check if the player's clan is already outnumbering the PvP
@ -114,42 +144,6 @@ public class FindPvP implements IBypassHandler
return false; return false;
} }
private L2PcInstance getMostPvP()
{
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;
}
}
return mostPvP;
}
@Override @Override
public String[] getBypassList() public String[] getBypassList()
{ {

View File

@ -48,7 +48,37 @@ public class FindPvP implements IBypassHandler
return false; return false;
} }
final L2PcInstance mostPvP = getMostPvP(); 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) if (mostPvP != null)
{ {
// Check if the player's clan is already outnumbering the PvP // Check if the player's clan is already outnumbering the PvP
@ -114,42 +144,6 @@ public class FindPvP implements IBypassHandler
return false; return false;
} }
private L2PcInstance getMostPvP()
{
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;
}
}
return mostPvP;
}
@Override @Override
public String[] getBypassList() public String[] getBypassList()
{ {

View File

@ -48,7 +48,37 @@ public class FindPvP implements IBypassHandler
return false; return false;
} }
final L2PcInstance mostPvP = getMostPvP(); 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) if (mostPvP != null)
{ {
// Check if the player's clan is already outnumbering the PvP // Check if the player's clan is already outnumbering the PvP
@ -114,42 +144,6 @@ public class FindPvP implements IBypassHandler
return false; return false;
} }
private L2PcInstance getMostPvP()
{
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;
}
}
return mostPvP;
}
@Override @Override
public String[] getBypassList() public String[] getBypassList()
{ {

View File

@ -48,7 +48,37 @@ public class FindPvP implements IBypassHandler
return false; return false;
} }
final L2PcInstance mostPvP = getMostPvP(); 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 : player.getKnownList().getKnownPlayers().values())
{
if ((pl.getPvpFlag() > 0) && !pl.isInsideZone(ZoneId.PEACE))
{
count++;
}
}
if (count > max)
{
max = count;
mostPvP = player;
}
}
if (mostPvP != null) if (mostPvP != null)
{ {
// Check if the player's clan is already outnumbering the PvP // Check if the player's clan is already outnumbering the PvP
@ -114,42 +144,6 @@ public class FindPvP implements IBypassHandler
return false; return false;
} }
private L2PcInstance getMostPvP()
{
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 : player.getKnownList().getKnownPlayers().values())
{
if ((pl.getPvpFlag() > 0) && !pl.isInsideZone(ZoneId.PEACE))
{
count++;
}
}
if (count > max)
{
max = count;
mostPvP = player;
}
}
return mostPvP;
}
@Override @Override
public String[] getBypassList() public String[] getBypassList()
{ {

View File

@ -48,7 +48,37 @@ public class FindPvP implements IBypassHandler
return false; return false;
} }
final L2PcInstance mostPvP = getMostPvP(); 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) if (mostPvP != null)
{ {
// Check if the player's clan is already outnumbering the PvP // Check if the player's clan is already outnumbering the PvP
@ -114,42 +144,6 @@ public class FindPvP implements IBypassHandler
return false; return false;
} }
private L2PcInstance getMostPvP()
{
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;
}
}
return mostPvP;
}
@Override @Override
public String[] getBypassList() public String[] getBypassList()
{ {