Custom FindPvP bypass.
This commit is contained in:
parent
a1316992c2
commit
5e046c297d
9
L2J_Mobius_1.0_Ertheia/dist/game/config/Custom/FindPvP.ini
vendored
Normal file
9
L2J_Mobius_1.0_Ertheia/dist/game/config/Custom/FindPvP.ini
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Find PvP
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Bypass example:
|
||||||
|
# <Button ALIGN=LEFT ICON="NORMAL" action="bypass -h FindPvP">Go to PvP!</Button>
|
||||||
|
|
||||||
|
# Enable FindPvP bypass.
|
||||||
|
# Default: False
|
||||||
|
EnableFindPvP = False
|
@ -140,6 +140,7 @@ import handlers.bypasshandlers.BuyShadowItem;
|
|||||||
import handlers.bypasshandlers.ChatLink;
|
import handlers.bypasshandlers.ChatLink;
|
||||||
import handlers.bypasshandlers.ClanWarehouse;
|
import handlers.bypasshandlers.ClanWarehouse;
|
||||||
import handlers.bypasshandlers.EventEngine;
|
import handlers.bypasshandlers.EventEngine;
|
||||||
|
import handlers.bypasshandlers.FindPvP;
|
||||||
import handlers.bypasshandlers.Freight;
|
import handlers.bypasshandlers.Freight;
|
||||||
import handlers.bypasshandlers.ItemAuctionLink;
|
import handlers.bypasshandlers.ItemAuctionLink;
|
||||||
import handlers.bypasshandlers.Link;
|
import handlers.bypasshandlers.Link;
|
||||||
@ -470,6 +471,7 @@ public class MasterHandler
|
|||||||
ChatLink.class,
|
ChatLink.class,
|
||||||
ClanWarehouse.class,
|
ClanWarehouse.class,
|
||||||
EventEngine.class,
|
EventEngine.class,
|
||||||
|
FindPvP.class,
|
||||||
Freight.class,
|
Freight.class,
|
||||||
ItemAuctionLink.class,
|
ItemAuctionLink.class,
|
||||||
Link.class,
|
Link.class,
|
||||||
|
158
L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java
vendored
Normal file
158
L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java
vendored
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
final L2PcInstance mostPvP = getMostPvP();
|
||||||
|
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.setProtection(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
public String[] getBypassList()
|
||||||
|
{
|
||||||
|
return COMMANDS;
|
||||||
|
}
|
||||||
|
}
|
@ -115,6 +115,7 @@ public final class Config
|
|||||||
public static final String CUSTOM_DEBUG_VOICE_COMMAND_CONFIG_FILE = "./config/Custom/DebugVoiceCommand.ini";
|
public static final String CUSTOM_DEBUG_VOICE_COMMAND_CONFIG_FILE = "./config/Custom/DebugVoiceCommand.ini";
|
||||||
public static final String CUSTOM_DUALBOX_CHECK_CONFIG_FILE = "./config/Custom/DualboxCheck.ini";
|
public static final String CUSTOM_DUALBOX_CHECK_CONFIG_FILE = "./config/Custom/DualboxCheck.ini";
|
||||||
public static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini";
|
public static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini";
|
||||||
|
public static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini";
|
||||||
public static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini";
|
public static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini";
|
||||||
public static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
|
public static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
|
||||||
public static final String CUSTOM_OLD_DROP_BEHAVIOR_CONFIG_FILE = "./config/Custom/OldDropBehavior.ini";
|
public static final String CUSTOM_OLD_DROP_BEHAVIOR_CONFIG_FILE = "./config/Custom/OldDropBehavior.ini";
|
||||||
@ -1095,6 +1096,7 @@ public final class Config
|
|||||||
public static boolean FACTION_SPECIFIC_CHAT;
|
public static boolean FACTION_SPECIFIC_CHAT;
|
||||||
public static boolean FACTION_BALANCE_ONLINE_PLAYERS;
|
public static boolean FACTION_BALANCE_ONLINE_PLAYERS;
|
||||||
public static int FACTION_BALANCE_PLAYER_EXCEED_LIMIT;
|
public static int FACTION_BALANCE_PLAYER_EXCEED_LIMIT;
|
||||||
|
public static boolean ENABLE_FIND_PVP;
|
||||||
public static boolean PREMIUM_SYSTEM_ENABLED;
|
public static boolean PREMIUM_SYSTEM_ENABLED;
|
||||||
public static float PREMIUM_RATE_XP;
|
public static float PREMIUM_RATE_XP;
|
||||||
public static float PREMIUM_RATE_SP;
|
public static float PREMIUM_RATE_SP;
|
||||||
@ -2447,6 +2449,10 @@ public final class Config
|
|||||||
FACTION_BALANCE_ONLINE_PLAYERS = FactionSystem.getBoolean("BalanceOnlinePlayers", true);
|
FACTION_BALANCE_ONLINE_PLAYERS = FactionSystem.getBoolean("BalanceOnlinePlayers", true);
|
||||||
FACTION_BALANCE_PLAYER_EXCEED_LIMIT = FactionSystem.getInt("BalancePlayerExceedLimit", 20);
|
FACTION_BALANCE_PLAYER_EXCEED_LIMIT = FactionSystem.getInt("BalancePlayerExceedLimit", 20);
|
||||||
|
|
||||||
|
// Load FindPvP config file (if exists)
|
||||||
|
final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE);
|
||||||
|
ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false);
|
||||||
|
|
||||||
// Load MultilingualSupport config file (if exists)
|
// Load MultilingualSupport config file (if exists)
|
||||||
final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE);
|
final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE);
|
||||||
|
|
||||||
|
9
L2J_Mobius_2.5_Underground/dist/game/config/Custom/FindPvP.ini
vendored
Normal file
9
L2J_Mobius_2.5_Underground/dist/game/config/Custom/FindPvP.ini
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Find PvP
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Bypass example:
|
||||||
|
# <Button ALIGN=LEFT ICON="NORMAL" action="bypass -h FindPvP">Go to PvP!</Button>
|
||||||
|
|
||||||
|
# Enable FindPvP bypass.
|
||||||
|
# Default: False
|
||||||
|
EnableFindPvP = False
|
@ -141,6 +141,7 @@ import handlers.bypasshandlers.ChatLink;
|
|||||||
import handlers.bypasshandlers.ClanWarehouse;
|
import handlers.bypasshandlers.ClanWarehouse;
|
||||||
import handlers.bypasshandlers.EnsoulWindow;
|
import handlers.bypasshandlers.EnsoulWindow;
|
||||||
import handlers.bypasshandlers.EventEngine;
|
import handlers.bypasshandlers.EventEngine;
|
||||||
|
import handlers.bypasshandlers.FindPvP;
|
||||||
import handlers.bypasshandlers.Freight;
|
import handlers.bypasshandlers.Freight;
|
||||||
import handlers.bypasshandlers.ItemAuctionLink;
|
import handlers.bypasshandlers.ItemAuctionLink;
|
||||||
import handlers.bypasshandlers.Link;
|
import handlers.bypasshandlers.Link;
|
||||||
@ -472,6 +473,7 @@ public class MasterHandler
|
|||||||
ClanWarehouse.class,
|
ClanWarehouse.class,
|
||||||
EnsoulWindow.class,
|
EnsoulWindow.class,
|
||||||
EventEngine.class,
|
EventEngine.class,
|
||||||
|
FindPvP.class,
|
||||||
Freight.class,
|
Freight.class,
|
||||||
ItemAuctionLink.class,
|
ItemAuctionLink.class,
|
||||||
Link.class,
|
Link.class,
|
||||||
|
158
L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java
vendored
Normal file
158
L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java
vendored
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
final L2PcInstance mostPvP = getMostPvP();
|
||||||
|
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.setProtection(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
public String[] getBypassList()
|
||||||
|
{
|
||||||
|
return COMMANDS;
|
||||||
|
}
|
||||||
|
}
|
@ -115,6 +115,7 @@ public final class Config
|
|||||||
public static final String CUSTOM_DEBUG_VOICE_COMMAND_CONFIG_FILE = "./config/Custom/DebugVoiceCommand.ini";
|
public static final String CUSTOM_DEBUG_VOICE_COMMAND_CONFIG_FILE = "./config/Custom/DebugVoiceCommand.ini";
|
||||||
public static final String CUSTOM_DUALBOX_CHECK_CONFIG_FILE = "./config/Custom/DualboxCheck.ini";
|
public static final String CUSTOM_DUALBOX_CHECK_CONFIG_FILE = "./config/Custom/DualboxCheck.ini";
|
||||||
public static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini";
|
public static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini";
|
||||||
|
public static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini";
|
||||||
public static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini";
|
public static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini";
|
||||||
public static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
|
public static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
|
||||||
public static final String CUSTOM_OLD_DROP_BEHAVIOR_CONFIG_FILE = "./config/Custom/OldDropBehavior.ini";
|
public static final String CUSTOM_OLD_DROP_BEHAVIOR_CONFIG_FILE = "./config/Custom/OldDropBehavior.ini";
|
||||||
@ -1097,6 +1098,7 @@ public final class Config
|
|||||||
public static boolean FACTION_SPECIFIC_CHAT;
|
public static boolean FACTION_SPECIFIC_CHAT;
|
||||||
public static boolean FACTION_BALANCE_ONLINE_PLAYERS;
|
public static boolean FACTION_BALANCE_ONLINE_PLAYERS;
|
||||||
public static int FACTION_BALANCE_PLAYER_EXCEED_LIMIT;
|
public static int FACTION_BALANCE_PLAYER_EXCEED_LIMIT;
|
||||||
|
public static boolean ENABLE_FIND_PVP;
|
||||||
public static boolean PREMIUM_SYSTEM_ENABLED;
|
public static boolean PREMIUM_SYSTEM_ENABLED;
|
||||||
public static float PREMIUM_RATE_XP;
|
public static float PREMIUM_RATE_XP;
|
||||||
public static float PREMIUM_RATE_SP;
|
public static float PREMIUM_RATE_SP;
|
||||||
@ -2451,6 +2453,10 @@ public final class Config
|
|||||||
FACTION_BALANCE_ONLINE_PLAYERS = FactionSystem.getBoolean("BalanceOnlinePlayers", true);
|
FACTION_BALANCE_ONLINE_PLAYERS = FactionSystem.getBoolean("BalanceOnlinePlayers", true);
|
||||||
FACTION_BALANCE_PLAYER_EXCEED_LIMIT = FactionSystem.getInt("BalancePlayerExceedLimit", 20);
|
FACTION_BALANCE_PLAYER_EXCEED_LIMIT = FactionSystem.getInt("BalancePlayerExceedLimit", 20);
|
||||||
|
|
||||||
|
// Load FindPvP config file (if exists)
|
||||||
|
final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE);
|
||||||
|
ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false);
|
||||||
|
|
||||||
// Load MultilingualSupport config file (if exists)
|
// Load MultilingualSupport config file (if exists)
|
||||||
final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE);
|
final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE);
|
||||||
|
|
||||||
|
9
L2J_Mobius_3.0_Helios/dist/game/config/Custom/FindPvP.ini
vendored
Normal file
9
L2J_Mobius_3.0_Helios/dist/game/config/Custom/FindPvP.ini
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Find PvP
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Bypass example:
|
||||||
|
# <Button ALIGN=LEFT ICON="NORMAL" action="bypass -h FindPvP">Go to PvP!</Button>
|
||||||
|
|
||||||
|
# Enable FindPvP bypass.
|
||||||
|
# Default: False
|
||||||
|
EnableFindPvP = False
|
@ -141,6 +141,7 @@ import handlers.bypasshandlers.ChatLink;
|
|||||||
import handlers.bypasshandlers.ClanWarehouse;
|
import handlers.bypasshandlers.ClanWarehouse;
|
||||||
import handlers.bypasshandlers.EnsoulWindow;
|
import handlers.bypasshandlers.EnsoulWindow;
|
||||||
import handlers.bypasshandlers.EventEngine;
|
import handlers.bypasshandlers.EventEngine;
|
||||||
|
import handlers.bypasshandlers.FindPvP;
|
||||||
import handlers.bypasshandlers.Freight;
|
import handlers.bypasshandlers.Freight;
|
||||||
import handlers.bypasshandlers.ItemAuctionLink;
|
import handlers.bypasshandlers.ItemAuctionLink;
|
||||||
import handlers.bypasshandlers.Link;
|
import handlers.bypasshandlers.Link;
|
||||||
@ -473,6 +474,7 @@ public class MasterHandler
|
|||||||
ClanWarehouse.class,
|
ClanWarehouse.class,
|
||||||
EnsoulWindow.class,
|
EnsoulWindow.class,
|
||||||
EventEngine.class,
|
EventEngine.class,
|
||||||
|
FindPvP.class,
|
||||||
Freight.class,
|
Freight.class,
|
||||||
ItemAuctionLink.class,
|
ItemAuctionLink.class,
|
||||||
Link.class,
|
Link.class,
|
||||||
|
158
L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java
vendored
Normal file
158
L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java
vendored
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
final L2PcInstance mostPvP = getMostPvP();
|
||||||
|
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.setProtection(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
public String[] getBypassList()
|
||||||
|
{
|
||||||
|
return COMMANDS;
|
||||||
|
}
|
||||||
|
}
|
@ -115,6 +115,7 @@ public final class Config
|
|||||||
public static final String CUSTOM_DEBUG_VOICE_COMMAND_CONFIG_FILE = "./config/Custom/DebugVoiceCommand.ini";
|
public static final String CUSTOM_DEBUG_VOICE_COMMAND_CONFIG_FILE = "./config/Custom/DebugVoiceCommand.ini";
|
||||||
public static final String CUSTOM_DUALBOX_CHECK_CONFIG_FILE = "./config/Custom/DualboxCheck.ini";
|
public static final String CUSTOM_DUALBOX_CHECK_CONFIG_FILE = "./config/Custom/DualboxCheck.ini";
|
||||||
public static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini";
|
public static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini";
|
||||||
|
public static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini";
|
||||||
public static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini";
|
public static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini";
|
||||||
public static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
|
public static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
|
||||||
public static final String CUSTOM_OLD_DROP_BEHAVIOR_CONFIG_FILE = "./config/Custom/OldDropBehavior.ini";
|
public static final String CUSTOM_OLD_DROP_BEHAVIOR_CONFIG_FILE = "./config/Custom/OldDropBehavior.ini";
|
||||||
@ -1097,6 +1098,7 @@ public final class Config
|
|||||||
public static boolean FACTION_SPECIFIC_CHAT;
|
public static boolean FACTION_SPECIFIC_CHAT;
|
||||||
public static boolean FACTION_BALANCE_ONLINE_PLAYERS;
|
public static boolean FACTION_BALANCE_ONLINE_PLAYERS;
|
||||||
public static int FACTION_BALANCE_PLAYER_EXCEED_LIMIT;
|
public static int FACTION_BALANCE_PLAYER_EXCEED_LIMIT;
|
||||||
|
public static boolean ENABLE_FIND_PVP;
|
||||||
public static boolean PREMIUM_SYSTEM_ENABLED;
|
public static boolean PREMIUM_SYSTEM_ENABLED;
|
||||||
public static float PREMIUM_RATE_XP;
|
public static float PREMIUM_RATE_XP;
|
||||||
public static float PREMIUM_RATE_SP;
|
public static float PREMIUM_RATE_SP;
|
||||||
@ -2451,6 +2453,10 @@ public final class Config
|
|||||||
FACTION_BALANCE_ONLINE_PLAYERS = FactionSystem.getBoolean("BalanceOnlinePlayers", true);
|
FACTION_BALANCE_ONLINE_PLAYERS = FactionSystem.getBoolean("BalanceOnlinePlayers", true);
|
||||||
FACTION_BALANCE_PLAYER_EXCEED_LIMIT = FactionSystem.getInt("BalancePlayerExceedLimit", 20);
|
FACTION_BALANCE_PLAYER_EXCEED_LIMIT = FactionSystem.getInt("BalancePlayerExceedLimit", 20);
|
||||||
|
|
||||||
|
// Load FindPvP config file (if exists)
|
||||||
|
final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE);
|
||||||
|
ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false);
|
||||||
|
|
||||||
// Load MultilingualSupport config file (if exists)
|
// Load MultilingualSupport config file (if exists)
|
||||||
final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE);
|
final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE);
|
||||||
|
|
||||||
|
@ -693,3 +693,14 @@ PremiumRateSpoilAmount = 2
|
|||||||
# Usage: itemId1,multiplier1;itemId2,multiplier2;...
|
# Usage: itemId1,multiplier1;itemId2,multiplier2;...
|
||||||
PremiumRateDropChanceByItemId = 57,2;6656,1;6657,1;6658,1;6659,1;6660,1;6661,1;6662,1;8191,1;10170,1;10314,1
|
PremiumRateDropChanceByItemId = 57,2;6656,1;6657,1;6658,1;6659,1;6660,1;6661,1;6662,1;8191,1;10170,1;10314,1
|
||||||
PremiumRateDropAmountByItemId = 57,2;6656,1;6657,1;6658,1;6659,1;6660,1;6661,1;6662,1;8191,1;10170,1;10314,1
|
PremiumRateDropAmountByItemId = 57,2;6656,1;6657,1;6658,1;6659,1;6660,1;6661,1;6662,1;8191,1;10170,1;10314,1
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Find PvP
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Bypass example:
|
||||||
|
# <a action="bypass -h FindPvP">Go to PvP!</a>
|
||||||
|
|
||||||
|
# Enable FindPvP bypass.
|
||||||
|
# Default: False
|
||||||
|
EnableFindPvP = False
|
||||||
|
@ -136,6 +136,7 @@ import handlers.bypasshandlers.ChatLink;
|
|||||||
import handlers.bypasshandlers.ClanWarehouse;
|
import handlers.bypasshandlers.ClanWarehouse;
|
||||||
import handlers.bypasshandlers.EventEngine;
|
import handlers.bypasshandlers.EventEngine;
|
||||||
import handlers.bypasshandlers.Festival;
|
import handlers.bypasshandlers.Festival;
|
||||||
|
import handlers.bypasshandlers.FindPvP;
|
||||||
import handlers.bypasshandlers.Freight;
|
import handlers.bypasshandlers.Freight;
|
||||||
import handlers.bypasshandlers.ItemAuctionLink;
|
import handlers.bypasshandlers.ItemAuctionLink;
|
||||||
import handlers.bypasshandlers.Link;
|
import handlers.bypasshandlers.Link;
|
||||||
@ -416,6 +417,7 @@ public class MasterHandler
|
|||||||
ClanWarehouse.class,
|
ClanWarehouse.class,
|
||||||
EventEngine.class,
|
EventEngine.class,
|
||||||
Festival.class,
|
Festival.class,
|
||||||
|
FindPvP.class,
|
||||||
Freight.class,
|
Freight.class,
|
||||||
ItemAuctionLink.class,
|
ItemAuctionLink.class,
|
||||||
Link.class,
|
Link.class,
|
||||||
|
158
L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java
vendored
Normal file
158
L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java
vendored
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package handlers.bypasshandlers;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import com.l2jmobius.Config;
|
||||||
|
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;
|
||||||
|
import com.l2jmobius.util.Rnd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
|
|
||||||
|
final L2PcInstance mostPvP = getMostPvP();
|
||||||
|
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 : mostPvP.getKnownList().getKnownPlayers().values())
|
||||||
|
{
|
||||||
|
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.setProtection(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
public String[] getBypassList()
|
||||||
|
{
|
||||||
|
return COMMANDS;
|
||||||
|
}
|
||||||
|
}
|
@ -821,6 +821,7 @@ public final class Config
|
|||||||
public static float PREMIUM_RATE_SPOIL_AMOUNT;
|
public static float PREMIUM_RATE_SPOIL_AMOUNT;
|
||||||
public static Map<Integer, Float> PREMIUM_RATE_DROP_CHANCE_BY_ID;
|
public static Map<Integer, Float> PREMIUM_RATE_DROP_CHANCE_BY_ID;
|
||||||
public static Map<Integer, Float> PREMIUM_RATE_DROP_AMOUNT_BY_ID;
|
public static Map<Integer, Float> PREMIUM_RATE_DROP_AMOUNT_BY_ID;
|
||||||
|
public static boolean ENABLE_FIND_PVP;
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// NPC Settings
|
// NPC Settings
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
@ -2689,6 +2690,8 @@ public final class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENABLE_FIND_PVP = CustomSettings.getBoolean("EnableFindPvP", false);
|
||||||
|
|
||||||
// Load PvP L2Properties file (if exists)
|
// Load PvP L2Properties file (if exists)
|
||||||
final PropertiesParser PVPSettings = new PropertiesParser(PVP_CONFIG_FILE);
|
final PropertiesParser PVPSettings = new PropertiesParser(PVP_CONFIG_FILE);
|
||||||
|
|
||||||
|
9
L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Custom/FindPvP.ini
vendored
Normal file
9
L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Custom/FindPvP.ini
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Find PvP
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Bypass example:
|
||||||
|
# <Button ALIGN=LEFT ICON="NORMAL" action="bypass -h FindPvP">Go to PvP!</Button>
|
||||||
|
|
||||||
|
# Enable FindPvP bypass.
|
||||||
|
# Default: False
|
||||||
|
EnableFindPvP = False
|
@ -140,6 +140,7 @@ import handlers.bypasshandlers.ChatLink;
|
|||||||
import handlers.bypasshandlers.ClanWarehouse;
|
import handlers.bypasshandlers.ClanWarehouse;
|
||||||
import handlers.bypasshandlers.EnsoulWindow;
|
import handlers.bypasshandlers.EnsoulWindow;
|
||||||
import handlers.bypasshandlers.EventEngine;
|
import handlers.bypasshandlers.EventEngine;
|
||||||
|
import handlers.bypasshandlers.FindPvP;
|
||||||
import handlers.bypasshandlers.Freight;
|
import handlers.bypasshandlers.Freight;
|
||||||
import handlers.bypasshandlers.ItemAuctionLink;
|
import handlers.bypasshandlers.ItemAuctionLink;
|
||||||
import handlers.bypasshandlers.Link;
|
import handlers.bypasshandlers.Link;
|
||||||
@ -472,6 +473,7 @@ public class MasterHandler
|
|||||||
ClanWarehouse.class,
|
ClanWarehouse.class,
|
||||||
EnsoulWindow.class,
|
EnsoulWindow.class,
|
||||||
EventEngine.class,
|
EventEngine.class,
|
||||||
|
FindPvP.class,
|
||||||
Freight.class,
|
Freight.class,
|
||||||
ItemAuctionLink.class,
|
ItemAuctionLink.class,
|
||||||
Link.class,
|
Link.class,
|
||||||
|
158
L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java
vendored
Normal file
158
L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java
vendored
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
final L2PcInstance mostPvP = getMostPvP();
|
||||||
|
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.setProtection(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
public String[] getBypassList()
|
||||||
|
{
|
||||||
|
return COMMANDS;
|
||||||
|
}
|
||||||
|
}
|
@ -115,6 +115,7 @@ public final class Config
|
|||||||
public static final String CUSTOM_DEBUG_VOICE_COMMAND_CONFIG_FILE = "./config/Custom/DebugVoiceCommand.ini";
|
public static final String CUSTOM_DEBUG_VOICE_COMMAND_CONFIG_FILE = "./config/Custom/DebugVoiceCommand.ini";
|
||||||
public static final String CUSTOM_DUALBOX_CHECK_CONFIG_FILE = "./config/Custom/DualboxCheck.ini";
|
public static final String CUSTOM_DUALBOX_CHECK_CONFIG_FILE = "./config/Custom/DualboxCheck.ini";
|
||||||
public static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini";
|
public static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini";
|
||||||
|
public static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini";
|
||||||
public static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini";
|
public static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini";
|
||||||
public static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
|
public static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini";
|
||||||
public static final String CUSTOM_OLD_DROP_BEHAVIOR_CONFIG_FILE = "./config/Custom/OldDropBehavior.ini";
|
public static final String CUSTOM_OLD_DROP_BEHAVIOR_CONFIG_FILE = "./config/Custom/OldDropBehavior.ini";
|
||||||
@ -1046,6 +1047,7 @@ public final class Config
|
|||||||
public static boolean FACTION_SPECIFIC_CHAT;
|
public static boolean FACTION_SPECIFIC_CHAT;
|
||||||
public static boolean FACTION_BALANCE_ONLINE_PLAYERS;
|
public static boolean FACTION_BALANCE_ONLINE_PLAYERS;
|
||||||
public static int FACTION_BALANCE_PLAYER_EXCEED_LIMIT;
|
public static int FACTION_BALANCE_PLAYER_EXCEED_LIMIT;
|
||||||
|
public static boolean ENABLE_FIND_PVP;
|
||||||
public static boolean PREMIUM_SYSTEM_ENABLED;
|
public static boolean PREMIUM_SYSTEM_ENABLED;
|
||||||
public static float PREMIUM_RATE_XP;
|
public static float PREMIUM_RATE_XP;
|
||||||
public static float PREMIUM_RATE_SP;
|
public static float PREMIUM_RATE_SP;
|
||||||
@ -2360,6 +2362,10 @@ public final class Config
|
|||||||
FACTION_BALANCE_ONLINE_PLAYERS = FactionSystem.getBoolean("BalanceOnlinePlayers", true);
|
FACTION_BALANCE_ONLINE_PLAYERS = FactionSystem.getBoolean("BalanceOnlinePlayers", true);
|
||||||
FACTION_BALANCE_PLAYER_EXCEED_LIMIT = FactionSystem.getInt("BalancePlayerExceedLimit", 20);
|
FACTION_BALANCE_PLAYER_EXCEED_LIMIT = FactionSystem.getInt("BalancePlayerExceedLimit", 20);
|
||||||
|
|
||||||
|
// Load FindPvP config file (if exists)
|
||||||
|
final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE);
|
||||||
|
ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false);
|
||||||
|
|
||||||
// Load MultilingualSupport config file (if exists)
|
// Load MultilingualSupport config file (if exists)
|
||||||
final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE);
|
final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user