RequestHardWareInfo improvements.

This commit is contained in:
MobiusDev
2016-08-13 22:47:10 +00:00
parent 8253e4f0d8
commit 0bb4e57aad
6 changed files with 50 additions and 50 deletions

View File

@@ -115,7 +115,8 @@ ServerListBrackets = False
# Check if hardware information is sent upon login. # Check if hardware information is sent upon login.
# Players without hardware information are kicked from the game. # Players without hardware information are kicked from the game.
# To receive hardware information from client, l2.ini NetSendHardWare must be set to true. # WARNING: To receive hardware information from client, l2.ini NetSendHardWare must be set to true.
# WARNING: The file system\HardWare.ini must be deleted each time the player logins.(?)
# Default: False # Default: False
EnableHardwareInfo = False EnableHardwareInfo = False

View File

@@ -13,13 +13,12 @@
<tr><td><table width=290 border=0><tr><td width=50><font color="LEVEL">CPU:</font></td><td align=right width=290>%cpuName%</td></tr></table></td></tr> <tr><td><table width=290 border=0><tr><td width=50><font color="LEVEL">CPU:</font></td><td align=right width=290>%cpuName%</td></tr></table></td></tr>
<tr><td><table width=290 border=0 bgcolor=131210><tr><td width=100><font color="LEVEL">CPU Speed:</font></td><td align=right width=100>%cpuSpeed%</td></tr></table></td></tr> <tr><td><table width=290 border=0 bgcolor=131210><tr><td width=100><font color="LEVEL">CPU Speed:</font></td><td align=right width=100>%cpuSpeed%</td></tr></table></td></tr>
<tr><td><table width=290 border=0><tr><td width=100><font color="LEVEL">CPU Core Count:</font></td><td align=right width=170>%cpuCoreCount%</td></tr></table></td></tr> <tr><td><table width=290 border=0><tr><td width=100><font color="LEVEL">CPU Core Count:</font></td><td align=right width=170>%cpuCoreCount%</td></tr></table></td></tr>
<tr><td><table width=290 border=0 bgcolor=131210><tr><td width=100><font color="LEVEL">VGA:</font></td><td align=right width=170>%vgaName%</td></tr></table></td></tr> <tr><td><table width=290 border=0 bgcolor=131210><tr><td width=50><font color="LEVEL">VGA:</font></td><td align=right width=170>%vgaName%</td></tr></table></td></tr>
<tr><td><table width=290 border=0><tr><td width=100><font color="LEVEL">VGA Version:</font></td><td align=right width=170>%vgaVersion%</td></tr></table></td></tr> <tr><td><table width=290 border=0><tr><td width=100><font color="LEVEL">VGA Driver Version:</font></td><td align=right width=170>%vgaDriverVersion%</td></tr></table></td></tr>
<tr><td><table width=290 border=0 bgcolor=131210><tr><td width=100><font color="LEVEL">VGA Driver Version:</font></td><td align=right width=170>%vgaDriverVersion%</td></tr></table></td></tr> <tr><td><table width=290 border=0 bgcolor=131210><tr><td width=200><font color="LEVEL">Windows Platform Id:</font></td><td align=right width=170>%windowsPlatformId%</td></tr></table></td></tr>
<tr><td><table width=290 border=0><tr><td width=200><font color="LEVEL">Windows Platform Id:</font></td><td align=right width=170>%windowsPlatformId%</td></tr></table></td></tr> <tr><td><table width=290 border=0><tr><td width=200><font color="LEVEL">Windows Major Version:</font></td><td align=right width=170>%windowsMajorVersion%</td></tr></table></td></tr>
<tr><td><table width=290 border=0 bgcolor=131210><tr><td width=200><font color="LEVEL">Windows Major Version:</font></td><td align=right width=170>%windowsMajorVersion%</td></tr></table></td></tr> <tr><td><table width=290 border=0 bgcolor=131210><tr><td width=200><font color="LEVEL">Windows Minor Version:</font></td><td align=right width=170>%windowsMinorVersion%</td></tr></table></td></tr>
<tr><td><table width=290 border=0><tr><td width=200><font color="LEVEL">Windows Minor Version:</font></td><td align=right width=170>%windowsMinorVersion%</td></tr></table></td></tr> <tr><td><table width=290 border=0><tr><td width=200><font color="LEVEL">Windows Build:</font></td><td align=right width=170>%windowsBuildNumber%</td></tr></table></td></tr>
<tr><td><table width=290 border=0 bgcolor=131210><tr><td width=200><font color="LEVEL">Windows Build:</font></td><td align=right width=170>%windowsBuildNumber%</td></tr></table></td></tr>
</table> </table>
</center> </center>
</body></html> </body></html>

View File

@@ -51,7 +51,6 @@ public class AdminHwid implements IAdminCommandHandler
html.replace("%cpuName%", target.getClient().getHardwareInfo().getCpuName()); html.replace("%cpuName%", target.getClient().getHardwareInfo().getCpuName());
html.replace("%cpuSpeed%", target.getClient().getHardwareInfo().getCpuSpeed()); html.replace("%cpuSpeed%", target.getClient().getHardwareInfo().getCpuSpeed());
html.replace("%cpuCoreCount%", target.getClient().getHardwareInfo().getCpuCoreCount()); html.replace("%cpuCoreCount%", target.getClient().getHardwareInfo().getCpuCoreCount());
html.replace("%vgaVersion%", target.getClient().getHardwareInfo().getVgaVersion());
html.replace("%vgaName%", target.getClient().getHardwareInfo().getVgaName()); html.replace("%vgaName%", target.getClient().getHardwareInfo().getVgaName());
html.replace("%vgaDriverVersion%", target.getClient().getHardwareInfo().getVgaDriverVersion()); html.replace("%vgaDriverVersion%", target.getClient().getHardwareInfo().getVgaDriverVersion());
activeChar.sendPacket(html); activeChar.sendPacket(html);

View File

@@ -261,7 +261,7 @@ public enum ExIncomingPackets implements IIncomingPackets<L2GameClient>
REQUEST_GOODS_INVENTORY_ITEM(0xAB, null, ConnectionState.IN_GAME), REQUEST_GOODS_INVENTORY_ITEM(0xAB, null, ConnectionState.IN_GAME),
REQUEST_FIRST_PLAY_START(0xAC, null, ConnectionState.IN_GAME), REQUEST_FIRST_PLAY_START(0xAC, null, ConnectionState.IN_GAME),
REQUEST_FLY_MOVE_START(0xAD, RequestFlyMoveStart::new, ConnectionState.IN_GAME), REQUEST_FLY_MOVE_START(0xAD, RequestFlyMoveStart::new, ConnectionState.IN_GAME),
REQUEST_HARDWARE_INFO(0xAE, RequestHardWareInfo::new, ConnectionState.IN_GAME), REQUEST_HARDWARE_INFO(0xAE, RequestHardWareInfo::new, ConnectionState.values()),
SEND_CHANGE_ATTRIBUTE_TARGET_ITEM(0xB0, null, ConnectionState.IN_GAME), SEND_CHANGE_ATTRIBUTE_TARGET_ITEM(0xB0, null, ConnectionState.IN_GAME),
REQUEST_CHANGE_ATTRIBUTE_ITEM(0xB1, null, ConnectionState.IN_GAME), REQUEST_CHANGE_ATTRIBUTE_ITEM(0xB1, null, ConnectionState.IN_GAME),
REQUEST_CHANGE_ATTRIBUTE_CANCEL(0xB2, null, ConnectionState.IN_GAME), REQUEST_CHANGE_ATTRIBUTE_CANCEL(0xB2, null, ConnectionState.IN_GAME),

View File

@@ -19,6 +19,7 @@ package com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.LoginServerThread; import com.l2jmobius.gameserver.LoginServerThread;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.data.sql.impl.AnnouncementsTable; import com.l2jmobius.gameserver.data.sql.impl.AnnouncementsTable;
import com.l2jmobius.gameserver.data.sql.impl.OfflineTradersTable; import com.l2jmobius.gameserver.data.sql.impl.OfflineTradersTable;
@@ -94,7 +95,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PledgeShowMemberListAll;
import com.l2jmobius.gameserver.network.serverpackets.PledgeShowMemberListUpdate; import com.l2jmobius.gameserver.network.serverpackets.PledgeShowMemberListUpdate;
import com.l2jmobius.gameserver.network.serverpackets.PledgeSkillList; import com.l2jmobius.gameserver.network.serverpackets.PledgeSkillList;
import com.l2jmobius.gameserver.network.serverpackets.QuestList; import com.l2jmobius.gameserver.network.serverpackets.QuestList;
import com.l2jmobius.gameserver.network.serverpackets.ServerClose;
import com.l2jmobius.gameserver.network.serverpackets.ShortCutInit; import com.l2jmobius.gameserver.network.serverpackets.ShortCutInit;
import com.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import com.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
import com.l2jmobius.gameserver.network.serverpackets.SkillList; import com.l2jmobius.gameserver.network.serverpackets.SkillList;
@@ -119,13 +119,6 @@ public class EnterWorld implements IClientIncomingPacket
@Override @Override
public boolean read(L2GameClient client, PacketReader packet) public boolean read(L2GameClient client, PacketReader packet)
{ {
packet.readB(32); // Unknown Byte Array
packet.readD(); // Unknown Value
packet.readD(); // Unknown Value
packet.readD(); // Unknown Value
packet.readD(); // Unknown Value
packet.readB(32); // Unknown Byte Array
packet.readD(); // Unknown Value
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
{ {
for (int o = 0; o < 4; o++) for (int o = 0; o < 4; o++)
@@ -133,38 +126,18 @@ public class EnterWorld implements IClientIncomingPacket
tracert[i][o] = packet.readC(); tracert[i][o] = packet.readC();
} }
} }
packet.readD(); // Unknown Value
packet.readD(); // Unknown Value
packet.readD(); // Unknown Value
packet.readD(); // Unknown Value
packet.readB(64); // Unknown Byte Array
packet.readD(); // Unknown Value
return true; return true;
} }
@Override @Override
public void run(L2GameClient client) public void run(L2GameClient client)
{ {
// HWID
if (Config.HARDWARE_INFO_ENABLED)
{
if (client.getHardwareInfo() == null)
{
client.close(ServerClose.STATIC_PACKET);
return;
}
if (Config.MAX_PLAYERS_PER_HWID > 0)
{
int count = 0;
for (L2PcInstance player : L2World.getInstance().getPlayers())
{
if ((player.isOnlineInt() == 1) && (player.getClient().getHardwareInfo().equals(client.getHardwareInfo())))
{
count++;
}
}
if (count >= Config.MAX_PLAYERS_PER_HWID)
{
client.close(ServerClose.STATIC_PACKET);
return;
}
}
}
final L2PcInstance activeChar = client.getActiveChar(); final L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null) if (activeChar == null)
{ {
@@ -355,7 +328,7 @@ public class EnterWorld implements IClientIncomingPacket
} }
// Send GG check // Send GG check
activeChar.queryGameGuard(); // activeChar.queryGameGuard();
// Send Dye Information // Send Dye Information
activeChar.sendPacket(new HennaInfo(activeChar)); activeChar.sendPacket(new HennaInfo(activeChar));
@@ -656,6 +629,18 @@ public class EnterWorld implements IClientIncomingPacket
activeChar.sendPacket(new ExAutoSoulShot(0, false, 2)); activeChar.sendPacket(new ExAutoSoulShot(0, false, 2));
activeChar.sendPacket(new ExAutoSoulShot(0, false, 3)); activeChar.sendPacket(new ExAutoSoulShot(0, false, 3));
} }
if (Config.HARDWARE_INFO_ENABLED)
{
ThreadPoolManager.getInstance().scheduleGeneral(() ->
{
if (client.getHardwareInfo() == null)
{
client.closeNow();
return;
}
}, 5000);
}
} }
/** /**

View File

@@ -16,7 +16,10 @@
*/ */
package com.l2jmobius.gameserver.network.clientpackets; package com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.Config;
import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.ClientHardwareInfoHolder; import com.l2jmobius.gameserver.model.holders.ClientHardwareInfoHolder;
import com.l2jmobius.gameserver.network.client.L2GameClient; import com.l2jmobius.gameserver.network.client.L2GameClient;
@@ -55,10 +58,7 @@ public final class RequestHardWareInfo implements IClientIncomingPacket
_windowsBuildNumber = packet.readD(); _windowsBuildNumber = packet.readD();
_directxVersion = packet.readD(); _directxVersion = packet.readD();
_directxRevision = packet.readD(); _directxRevision = packet.readD();
for (int i = 0; i < 16; i++) packet.readB(16);
{
packet.readC();
}
_cpuName = packet.readS(); _cpuName = packet.readS();
_cpuSpeed = packet.readD(); _cpuSpeed = packet.readD();
_cpuCoreCount = packet.readC(); _cpuCoreCount = packet.readC();
@@ -71,7 +71,7 @@ public final class RequestHardWareInfo implements IClientIncomingPacket
packet.readC(); packet.readC();
_videoMemory = packet.readD(); _videoMemory = packet.readD();
packet.readD(); packet.readD();
_vgaVersion = packet.readD(); _vgaVersion = packet.readH();
_vgaName = packet.readS(); _vgaName = packet.readS();
_vgaDriverVersion = packet.readS(); _vgaDriverVersion = packet.readS();
return true; return true;
@@ -81,5 +81,21 @@ public final class RequestHardWareInfo implements IClientIncomingPacket
public void run(L2GameClient client) public void run(L2GameClient client)
{ {
client.setHardwareInfo(new ClientHardwareInfoHolder(_macAddress, _windowsPlatformId, _windowsMajorVersion, _windowsMinorVersion, _windowsBuildNumber, _directxVersion, _directxRevision, _cpuName, _cpuSpeed, _cpuCoreCount, _vgaCount, _vgaPcxSpeed, _physMemorySlot1, _physMemorySlot2, _physMemorySlot3, _videoMemory, _vgaVersion, _vgaName, _vgaDriverVersion)); client.setHardwareInfo(new ClientHardwareInfoHolder(_macAddress, _windowsPlatformId, _windowsMajorVersion, _windowsMinorVersion, _windowsBuildNumber, _directxVersion, _directxRevision, _cpuName, _cpuSpeed, _cpuCoreCount, _vgaCount, _vgaPcxSpeed, _physMemorySlot1, _physMemorySlot2, _physMemorySlot3, _videoMemory, _vgaVersion, _vgaName, _vgaDriverVersion));
if (Config.HARDWARE_INFO_ENABLED && (Config.MAX_PLAYERS_PER_HWID > 0))
{
int count = 0;
for (L2PcInstance player : L2World.getInstance().getPlayers())
{
if ((player.isOnlineInt() == 1) && (player.getClient().getHardwareInfo().equals(client.getHardwareInfo())))
{
count++;
}
}
if (count >= Config.MAX_PLAYERS_PER_HWID)
{
client.closeNow();
return;
}
}
} }
} }