Implemented HWID punishment affect.
This commit is contained in:
@@ -157,6 +157,26 @@ DeadLockCheckInterval = 20
|
||||
RestartOnDeadlock = False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Player HWID settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Check if hardware information is sent upon login.
|
||||
# WARNING: To receive hardware information client needs a modified
|
||||
# system for setting GameClient HWID via the setHardwareInfo method.
|
||||
# Default: False
|
||||
EnableHardwareInfo = False
|
||||
|
||||
# Players without hardware information are kicked from the game.
|
||||
# Automatically set to True when MaxPlayersPerHWID > 0.
|
||||
# Default: False
|
||||
KickMissingHWID = False
|
||||
|
||||
# Maximum number of players per HWID allowed to enter game.
|
||||
# Default: 0 (unlimited)
|
||||
MaxPlayersPerHWID = 0
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Misc Player Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<a action="bypass -h admin_punishment info %acc% ACCOUNT">Punishments for account: %acc%</a><br1>
|
||||
<a action="bypass -h admin_punishment info %char% CHARACTER">Punishments for character: %char%</a><br1>
|
||||
<a action="bypass -h admin_punishment info %ip% IP">Punishments for IP: %ip%</a><br1>
|
||||
<a action="bypass -h admin_punishment info %hwid% HWID">Punishments for HWID: %hwid%</a><br1>
|
||||
<br>
|
||||
<table width=280 bgcolor="666666" cellspacing="0" cellpadding="6">
|
||||
<tr>
|
||||
@@ -41,6 +42,11 @@
|
||||
<td>%ip%</td>
|
||||
<td><a action="bypass -h admin_punishment_add %ip% IP $punishmentType $expiration $reason">Ban</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HWID:</td>
|
||||
<td>%hwid%</td>
|
||||
<td><a action="bypass -h admin_punishment_add %hwid% HWID $punishmentType $expiration $reason">Ban</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<br>
|
||||
|
||||
@@ -51,6 +51,11 @@
|
||||
<td><edit var="ip" width="130" height="12"></td>
|
||||
<td><a action="bypass -h admin_punishment_add $ip IP $punishmentType $expiration $reason">Ban</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HWID:</td>
|
||||
<td><edit var="hwid" width="130" height="12"></td>
|
||||
<td><a action="bypass -h admin_punishment_add $hwid HWID $punishmentType $expiration $reason">Ban</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<br>
|
||||
|
||||
@@ -54,6 +54,8 @@ public class AdminPunishment implements IAdminCommandHandler
|
||||
"admin_punishment_remove",
|
||||
"admin_ban_acc",
|
||||
"admin_unban_acc",
|
||||
"admin_ban_hwid",
|
||||
"admin_unban_hwid",
|
||||
"admin_ban_chat",
|
||||
"admin_unban_chat",
|
||||
"admin_ban_char",
|
||||
@@ -182,6 +184,7 @@ public class AdminPunishment implements IAdminCommandHandler
|
||||
content = content.replace("%acc%", target.getAccountName());
|
||||
content = content.replace("%char%", target.getName());
|
||||
content = content.replace("%ip%", target.getIPAddress());
|
||||
content = content.replace("%hwid%", (target.getClient() == null) || (target.getClient().getHardwareInfo() == null) ? "Unknown" : target.getClient().getHardwareInfo().getMacAddress());
|
||||
activeChar.sendPacket(new NpcHtmlMessage(0, 1, content));
|
||||
}
|
||||
else
|
||||
@@ -355,6 +358,22 @@ public class AdminPunishment implements IAdminCommandHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "admin_ban_hwid":
|
||||
{
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
return useAdminCommand(String.format("admin_punishment_add %s %s %s %s %s", st.nextToken(), PunishmentAffect.HWID, PunishmentType.BAN, 0, "Banned by admin"), activeChar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "admin_unban_hwid":
|
||||
{
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
return useAdminCommand(String.format("admin_punishment_remove %s %s %s", st.nextToken(), PunishmentAffect.HWID, PunishmentType.BAN), activeChar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "admin_ban_chat":
|
||||
{
|
||||
if (st.hasMoreTokens())
|
||||
|
||||
@@ -76,6 +76,19 @@ public class BanHandler implements IPunishmentHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HWID:
|
||||
{
|
||||
final String hwid = String.valueOf(task.getKey());
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
final GameClient client = player.getClient();
|
||||
if ((client != null) && client.getHardwareInfo().getMacAddress().equals(hwid))
|
||||
{
|
||||
applyToPlayer(player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,19 @@ public class ChatBanHandler implements IPunishmentHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HWID:
|
||||
{
|
||||
final String hwid = String.valueOf(task.getKey());
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
final GameClient client = player.getClient();
|
||||
if ((client != null) && client.getHardwareInfo().getMacAddress().equals(hwid))
|
||||
{
|
||||
applyToPlayer(task, player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +130,19 @@ public class ChatBanHandler implements IPunishmentHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HWID:
|
||||
{
|
||||
final String hwid = String.valueOf(task.getKey());
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
final GameClient client = player.getClient();
|
||||
if ((client != null) && client.getHardwareInfo().getMacAddress().equals(hwid))
|
||||
{
|
||||
removeFromPlayer(player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,19 @@ public class JailHandler implements IPunishmentHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HWID:
|
||||
{
|
||||
final String hwid = String.valueOf(task.getKey());
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
final GameClient client = player.getClient();
|
||||
if ((client != null) && client.getHardwareInfo().getMacAddress().equals(hwid))
|
||||
{
|
||||
applyToPlayer(task, player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,6 +160,19 @@ public class JailHandler implements IPunishmentHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HWID:
|
||||
{
|
||||
final String hwid = String.valueOf(task.getKey());
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
final GameClient client = player.getClient();
|
||||
if ((client != null) && client.getHardwareInfo().getMacAddress().equals(hwid))
|
||||
{
|
||||
removeFromPlayer(player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -886,6 +886,9 @@ public class Config
|
||||
public static String BACKUP_PATH;
|
||||
public static int BACKUP_DAYS;
|
||||
public static int MAXIMUM_ONLINE_USERS;
|
||||
public static boolean HARDWARE_INFO_ENABLED;
|
||||
public static boolean KICK_MISSING_HWID;
|
||||
public static int MAX_PLAYERS_PER_HWID;
|
||||
public static Pattern CHARNAME_TEMPLATE_PATTERN;
|
||||
public static String PET_NAME_TEMPLATE;
|
||||
public static String CLAN_NAME_TEMPLATE;
|
||||
@@ -1456,6 +1459,13 @@ public class Config
|
||||
CLAN_NAME_TEMPLATE = serverSettings.getString("ClanNameTemplate", ".*");
|
||||
MAX_CHARACTERS_NUMBER_PER_ACCOUNT = serverSettings.getInt("CharMaxNumber", 7);
|
||||
MAXIMUM_ONLINE_USERS = serverSettings.getInt("MaximumOnlineUsers", 2000);
|
||||
HARDWARE_INFO_ENABLED = serverSettings.getBoolean("EnableHardwareInfo", false);
|
||||
KICK_MISSING_HWID = serverSettings.getBoolean("KickMissingHWID", false);
|
||||
MAX_PLAYERS_PER_HWID = serverSettings.getInt("MaxPlayersPerHWID", 0);
|
||||
if (MAX_PLAYERS_PER_HWID > 0)
|
||||
{
|
||||
KICK_MISSING_HWID = true;
|
||||
}
|
||||
final String[] protocols = serverSettings.getString("AllowedProtocolRevisions", "267;268;271;273").split(";");
|
||||
PROTOCOL_LIST = new ArrayList<>(protocols.length);
|
||||
for (String protocol : protocols)
|
||||
|
||||
@@ -12064,7 +12064,10 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean isJailed()
|
||||
{
|
||||
return PunishmentManager.getInstance().hasPunishment(getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.JAIL) || PunishmentManager.getInstance().hasPunishment(getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.JAIL) || PunishmentManager.getInstance().hasPunishment(getIPAddress(), PunishmentAffect.IP, PunishmentType.JAIL);
|
||||
return PunishmentManager.getInstance().hasPunishment(getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.JAIL) //
|
||||
|| PunishmentManager.getInstance().hasPunishment(getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.JAIL) //
|
||||
|| PunishmentManager.getInstance().hasPunishment(getIPAddress(), PunishmentAffect.IP, PunishmentType.JAIL) //
|
||||
|| ((_client.getHardwareInfo() != null) && PunishmentManager.getInstance().hasPunishment(_client.getHardwareInfo().getMacAddress(), PunishmentAffect.HWID, PunishmentType.JAIL));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12072,7 +12075,10 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean isChatBanned()
|
||||
{
|
||||
return PunishmentManager.getInstance().hasPunishment(getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN) || PunishmentManager.getInstance().hasPunishment(getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.CHAT_BAN) || PunishmentManager.getInstance().hasPunishment(getIPAddress(), PunishmentAffect.IP, PunishmentType.CHAT_BAN);
|
||||
return PunishmentManager.getInstance().hasPunishment(getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN) //
|
||||
|| PunishmentManager.getInstance().hasPunishment(getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.CHAT_BAN) //
|
||||
|| PunishmentManager.getInstance().hasPunishment(getIPAddress(), PunishmentAffect.IP, PunishmentType.CHAT_BAN) //
|
||||
|| ((_client.getHardwareInfo() != null) && PunishmentManager.getInstance().hasPunishment(_client.getHardwareInfo().getMacAddress(), PunishmentAffect.HWID, PunishmentType.CHAT_BAN));
|
||||
}
|
||||
|
||||
public void startFameTask(long delay, int fameFixRate)
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.gameserver.model.holders;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.variables.AccountVariables;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ClientHardwareInfoHolder
|
||||
{
|
||||
private final String _macAddress;
|
||||
private final int _windowsPlatformId;
|
||||
private final int _windowsMajorVersion;
|
||||
private final int _windowsMinorVersion;
|
||||
private final int _windowsBuildNumber;
|
||||
private final int _directxVersion;
|
||||
private final int _directxRevision;
|
||||
private final String _cpuName;
|
||||
private final int _cpuSpeed;
|
||||
private final int _cpuCoreCount;
|
||||
private final int _vgaCount;
|
||||
private final int _vgaPcxSpeed;
|
||||
private final int _physMemorySlot1;
|
||||
private final int _physMemorySlot2;
|
||||
private final int _physMemorySlot3;
|
||||
private final int _videoMemory;
|
||||
private final int _vgaVersion;
|
||||
private final String _vgaName;
|
||||
private final String _vgaDriverVersion;
|
||||
|
||||
public ClientHardwareInfoHolder(String macAddress, int windowsPlatformId, int windowsMajorVersion, int windowsMinorVersion, int windowsBuildNumber, int directxVersion, int directxRevision, String cpuName, int cpuSpeed, int cpuCoreCount, int vgaCount, int vgaPcxSpeed, int physMemorySlot1, int physMemorySlot2, int physMemorySlot3, int videoMemory, int vgaVersion, String vgaName, String vgaDriverVersion)
|
||||
{
|
||||
_macAddress = macAddress;
|
||||
_windowsPlatformId = windowsPlatformId;
|
||||
_windowsMajorVersion = windowsMajorVersion;
|
||||
_windowsMinorVersion = windowsMinorVersion;
|
||||
_windowsBuildNumber = windowsBuildNumber;
|
||||
_directxVersion = directxVersion;
|
||||
_directxRevision = directxRevision;
|
||||
_cpuName = cpuName;
|
||||
_cpuSpeed = cpuSpeed;
|
||||
_cpuCoreCount = cpuCoreCount;
|
||||
_vgaCount = vgaCount;
|
||||
_vgaPcxSpeed = vgaPcxSpeed;
|
||||
_physMemorySlot1 = physMemorySlot1;
|
||||
_physMemorySlot2 = physMemorySlot2;
|
||||
_physMemorySlot3 = physMemorySlot3;
|
||||
_videoMemory = videoMemory;
|
||||
_vgaVersion = vgaVersion;
|
||||
_vgaName = vgaName;
|
||||
_vgaDriverVersion = vgaDriverVersion;
|
||||
}
|
||||
|
||||
public ClientHardwareInfoHolder(String info)
|
||||
{
|
||||
final String[] split = info.split(AccountVariables.HWIDSLIT_VAR);
|
||||
_macAddress = split[0];
|
||||
_windowsPlatformId = Integer.valueOf(split[1]);
|
||||
_windowsMajorVersion = Integer.valueOf(split[2]);
|
||||
_windowsMinorVersion = Integer.valueOf(split[3]);
|
||||
_windowsBuildNumber = Integer.valueOf(split[4]);
|
||||
_directxVersion = Integer.valueOf(split[5]);
|
||||
_directxRevision = Integer.valueOf(split[6]);
|
||||
_cpuName = split[7];
|
||||
_cpuSpeed = Integer.valueOf(split[8]);
|
||||
_cpuCoreCount = Integer.valueOf(split[9]);
|
||||
_vgaCount = Integer.valueOf(split[10]);
|
||||
_vgaPcxSpeed = Integer.valueOf(split[11]);
|
||||
_physMemorySlot1 = Integer.valueOf(split[12]);
|
||||
_physMemorySlot2 = Integer.valueOf(split[13]);
|
||||
_physMemorySlot3 = Integer.valueOf(split[14]);
|
||||
_videoMemory = Integer.valueOf(split[15]);
|
||||
_vgaVersion = Integer.valueOf(split[16]);
|
||||
_vgaName = split[17];
|
||||
_vgaDriverVersion = split[18];
|
||||
}
|
||||
|
||||
/**
|
||||
* Save hardware info to account variables for later use.
|
||||
* @param player The PlayerInstance related with this hardware info.
|
||||
*/
|
||||
public void store(PlayerInstance player)
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(_macAddress);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_windowsPlatformId);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_windowsMajorVersion);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_windowsMinorVersion);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_windowsBuildNumber);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_directxVersion);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_directxRevision);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_cpuName);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_cpuSpeed);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_cpuCoreCount);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_vgaCount);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_vgaPcxSpeed);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_physMemorySlot1);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_physMemorySlot2);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_physMemorySlot3);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_videoMemory);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_vgaVersion);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_vgaName);
|
||||
sb.append(AccountVariables.HWIDSLIT_VAR);
|
||||
sb.append(_vgaDriverVersion);
|
||||
player.getAccountVariables().set(AccountVariables.HWID, sb.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the macAddress
|
||||
*/
|
||||
public String getMacAddress()
|
||||
{
|
||||
return _macAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the windowsPlatformId
|
||||
*/
|
||||
public int getWindowsPlatformId()
|
||||
{
|
||||
return _windowsPlatformId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the windowsMajorVersion
|
||||
*/
|
||||
public int getWindowsMajorVersion()
|
||||
{
|
||||
return _windowsMajorVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the windowsMinorVersion
|
||||
*/
|
||||
public int getWindowsMinorVersion()
|
||||
{
|
||||
return _windowsMinorVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the windowsBuildNumber
|
||||
*/
|
||||
public int getWindowsBuildNumber()
|
||||
{
|
||||
return _windowsBuildNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the directxVersion
|
||||
*/
|
||||
public int getDirectxVersion()
|
||||
{
|
||||
return _directxVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the directxRevision
|
||||
*/
|
||||
public int getDirectxRevision()
|
||||
{
|
||||
return _directxRevision;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cpuName
|
||||
*/
|
||||
public String getCpuName()
|
||||
{
|
||||
return _cpuName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cpuSpeed
|
||||
*/
|
||||
public int getCpuSpeed()
|
||||
{
|
||||
return _cpuSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cpuCoreCount
|
||||
*/
|
||||
public int getCpuCoreCount()
|
||||
{
|
||||
return _cpuCoreCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vgaCount
|
||||
*/
|
||||
public int getVgaCount()
|
||||
{
|
||||
return _vgaCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vgaPcxSpeed
|
||||
*/
|
||||
public int getVgaPcxSpeed()
|
||||
{
|
||||
return _vgaPcxSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the physMemorySlot1
|
||||
*/
|
||||
public int getPhysMemorySlot1()
|
||||
{
|
||||
return _physMemorySlot1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the physMemorySlot2
|
||||
*/
|
||||
public int getPhysMemorySlot2()
|
||||
{
|
||||
return _physMemorySlot2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the physMemorySlot3
|
||||
*/
|
||||
public int getPhysMemorySlot3()
|
||||
{
|
||||
return _physMemorySlot3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the videoMemory
|
||||
*/
|
||||
public int getVideoMemory()
|
||||
{
|
||||
return _videoMemory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vgaVersion
|
||||
*/
|
||||
public int getVgaVersion()
|
||||
{
|
||||
return _vgaVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vgaName
|
||||
*/
|
||||
public String getVgaName()
|
||||
{
|
||||
return _vgaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vgaDriverVersion
|
||||
*/
|
||||
public String getVgaDriverVersion()
|
||||
{
|
||||
return _vgaDriverVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj instanceof ClientHardwareInfoHolder)
|
||||
{
|
||||
final ClientHardwareInfoHolder info = (ClientHardwareInfoHolder) obj;
|
||||
if ((_macAddress.equals(info.getMacAddress())) && //
|
||||
(_windowsPlatformId == info.getWindowsPlatformId()) && //
|
||||
(_windowsMajorVersion == info.getWindowsMajorVersion()) && //
|
||||
(_windowsMinorVersion == info.getWindowsMinorVersion()) && //
|
||||
(_windowsBuildNumber == info.getWindowsBuildNumber()) && //
|
||||
(_directxVersion == info.getDirectxVersion()) && //
|
||||
(_directxRevision == info.getDirectxRevision()) && //
|
||||
(_cpuName.equals(info.getCpuName())) && //
|
||||
(_cpuSpeed == info.getCpuSpeed()) && //
|
||||
(_cpuCoreCount == info.getCpuCoreCount()) && //
|
||||
(_vgaCount == info.getVgaCount()) && //
|
||||
(_vgaPcxSpeed == info.getVgaPcxSpeed()) && //
|
||||
(_physMemorySlot1 == info.getPhysMemorySlot1()) && //
|
||||
(_physMemorySlot2 == info.getPhysMemorySlot2()) && //
|
||||
(_physMemorySlot3 == info.getPhysMemorySlot3()) && //
|
||||
(_videoMemory == info.getVideoMemory()) && //
|
||||
(_vgaVersion == info.getVgaVersion()) && //
|
||||
(_vgaName.equals(info.getVgaName())) && //
|
||||
(_vgaDriverVersion.equals(info.getVgaDriverVersion())))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,10 @@ public class AccountVariables extends AbstractVariables
|
||||
private static final String DELETE_QUERY = "DELETE FROM account_gsdata WHERE account_name = ?";
|
||||
private static final String INSERT_QUERY = "INSERT INTO account_gsdata (account_name, var, value) VALUES (?, ?, ?)";
|
||||
|
||||
// Public variable names
|
||||
public static final String HWID = "HWID";
|
||||
public static final String HWIDSLIT_VAR = " ";
|
||||
|
||||
private final String _accountName;
|
||||
|
||||
public AccountVariables(String accountName)
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.l2jmobius.gameserver.model.CharSelectInfoPackage;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.holders.ClientHardwareInfoHolder;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.AbstractNpcInfo.NpcInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
|
||||
@@ -73,6 +74,7 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
private SessionKey _sessionId;
|
||||
private PlayerInstance _player;
|
||||
private SecondaryPasswordAuth _secondaryAuth;
|
||||
private ClientHardwareInfoHolder _hardwareInfo;
|
||||
private List<CharSelectInfoPackage> _charSlotMapping = null;
|
||||
private volatile boolean _isDetached = false;
|
||||
private boolean _isAuthedGG;
|
||||
@@ -689,4 +691,20 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
{
|
||||
return _crypt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hardwareInfo
|
||||
*/
|
||||
public ClientHardwareInfoHolder getHardwareInfo()
|
||||
{
|
||||
return _hardwareInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hardwareInfo
|
||||
*/
|
||||
public void setHardwareInfo(ClientHardwareInfoHolder hardwareInfo)
|
||||
{
|
||||
_hardwareInfo = hardwareInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,9 @@ public class CharacterSelect implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Banned?
|
||||
if (PunishmentManager.getInstance().hasPunishment(info.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN) || PunishmentManager.getInstance().hasPunishment(client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN) || PunishmentManager.getInstance().hasPunishment(client.getConnectionAddress().getHostAddress(), PunishmentAffect.IP, PunishmentType.BAN))
|
||||
if (PunishmentManager.getInstance().hasPunishment(info.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN) //
|
||||
|| PunishmentManager.getInstance().hasPunishment(client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN) //
|
||||
|| PunishmentManager.getInstance().hasPunishment(client.getConnectionAddress().getHostAddress(), PunishmentAffect.IP, PunishmentType.BAN))
|
||||
{
|
||||
client.close(ServerClose.STATIC_PACKET);
|
||||
return;
|
||||
|
||||
@@ -16,7 +16,11 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
@@ -38,6 +42,7 @@ import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MailManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.PetitionManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ServerRestartManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.TerritoryWarManager;
|
||||
@@ -50,7 +55,10 @@ import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.ClassMasterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.holders.ClientHardwareInfoHolder;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
import org.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import org.l2jmobius.gameserver.model.residences.AuctionableHall;
|
||||
@@ -60,6 +68,7 @@ import org.l2jmobius.gameserver.model.siege.FortSiege;
|
||||
import org.l2jmobius.gameserver.model.siege.Siege;
|
||||
import org.l2jmobius.gameserver.model.siege.clanhalls.SiegableHall;
|
||||
import org.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||
import org.l2jmobius.gameserver.model.variables.AccountVariables;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.ConnectionState;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
@@ -104,7 +113,9 @@ import org.l2jmobius.gameserver.util.BuilderUtil;
|
||||
*/
|
||||
public class EnterWorld implements IClientIncomingPacket
|
||||
{
|
||||
private final int[][] tracert = new int[5][4];
|
||||
private static final Map<String, ClientHardwareInfoHolder> TRACE_HWINFO = new ConcurrentHashMap<>();
|
||||
|
||||
private final int[][] _tracert = new int[5][4];
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
@@ -120,7 +131,7 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
{
|
||||
for (int o = 0; o < 4; o++)
|
||||
{
|
||||
tracert[i][o] = packet.readC();
|
||||
_tracert[i][o] = packet.readC();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -142,11 +153,11 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
final String[] adress = new String[5];
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
adress[i] = tracert[i][0] + "." + tracert[i][1] + "." + tracert[i][2] + "." + tracert[i][3];
|
||||
adress[i] = _tracert[i][0] + "." + _tracert[i][1] + "." + _tracert[i][2] + "." + _tracert[i][3];
|
||||
}
|
||||
|
||||
LoginServerThread.getInstance().sendClientTracert(player.getAccountName(), adress);
|
||||
client.setClientTracert(tracert);
|
||||
client.setClientTracert(_tracert);
|
||||
|
||||
// Restore to instanced area if enabled
|
||||
if (Config.RESTORE_PLAYER_INSTANCE)
|
||||
@@ -618,6 +629,82 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
|
||||
// Unstuck players that had client open when server crashed.
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
|
||||
// Delayed HWID checks.
|
||||
if (Config.HARDWARE_INFO_ENABLED)
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Generate trace string.
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (int[] i : _tracert)
|
||||
{
|
||||
for (int j : i)
|
||||
{
|
||||
sb.append(j);
|
||||
sb.append(".");
|
||||
}
|
||||
}
|
||||
final String trace = sb.toString();
|
||||
|
||||
// Get hardware info from client.
|
||||
ClientHardwareInfoHolder hwInfo = client.getHardwareInfo();
|
||||
if (hwInfo != null)
|
||||
{
|
||||
hwInfo.store(player);
|
||||
TRACE_HWINFO.put(trace, hwInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get hardware info from stored tracert map.
|
||||
hwInfo = TRACE_HWINFO.get(trace);
|
||||
if (hwInfo != null)
|
||||
{
|
||||
hwInfo.store(player);
|
||||
client.setHardwareInfo(hwInfo);
|
||||
}
|
||||
// Get hardware info from account variables.
|
||||
else
|
||||
{
|
||||
final String storedInfo = player.getAccountVariables().getString(AccountVariables.HWID, "");
|
||||
if (!storedInfo.isEmpty())
|
||||
{
|
||||
hwInfo = new ClientHardwareInfoHolder(storedInfo);
|
||||
TRACE_HWINFO.put(trace, hwInfo);
|
||||
client.setHardwareInfo(hwInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Banned?
|
||||
if ((hwInfo != null) && PunishmentManager.getInstance().hasPunishment(hwInfo.getMacAddress(), PunishmentAffect.HWID, PunishmentType.BAN))
|
||||
{
|
||||
Disconnection.of(client).defaultSequence(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check max players.
|
||||
if (Config.KICK_MISSING_HWID && (hwInfo == null))
|
||||
{
|
||||
Disconnection.of(client).defaultSequence(false);
|
||||
}
|
||||
else if (Config.MAX_PLAYERS_PER_HWID > 0)
|
||||
{
|
||||
int count = 0;
|
||||
for (PlayerInstance plr : World.getInstance().getPlayers())
|
||||
{
|
||||
if ((plr.isOnlineInt() == 1) && (plr.getClient().getHardwareInfo().equals(hwInfo)))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count >= Config.MAX_PLAYERS_PER_HWID)
|
||||
{
|
||||
Disconnection.of(client).defaultSequence(false);
|
||||
}
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
private void engage(PlayerInstance player)
|
||||
|
||||
Reference in New Issue
Block a user