Fast implementation of RequestHardWareInfo packet.

This commit is contained in:
MobiusDev
2016-08-13 13:37:16 +00:00
parent 16f47a60b1
commit 3f51a97be6
13 changed files with 471 additions and 3 deletions

View File

@@ -322,6 +322,10 @@
<admin command="admin_html" accessLevel="100" />
<admin command="admin_loadhtml" accessLevel="100" />
<!-- ADMIN HWID -->
<admin command="admin_hwid" accessLevel="100" />
<admin command="admin_hwinfo" accessLevel="100" />
<!-- ADMIN INSTANCE -->
<admin command="admin_instance" accessLevel="100" />
<admin command="admin_instances" accessLevel="100" />

View File

@@ -78,7 +78,7 @@ AcceptAlternateID = True
# Datapack root directory.
# Defaults to current directory from which the server is started unless the below line is uncommented.
# WARNING: <u><b><font color="red">If the specified path is invalid, it will lead to multiple errors!</font></b></u>
#Default: .
# Default: .
DatapackRoot = .
# Define how many players are allowed to play simultaneously on your server.
@@ -109,6 +109,21 @@ ServerListAge = 0
ServerListBrackets = False
# ---------------------------------------------------------------------------
# Player HWID settings (DO NOT USE)
# ---------------------------------------------------------------------------
# Check if hardware information is sent upon login.
# Players without hardware information are kicked from the game.
# To receive hardware information from client, l2.ini NetSendHardWare must be set to true.
# Default: False
EnableHardwareInfo = False
# Maximum number of players per HWID allowed to enter game.
# Default: 0 (unlimited)
MaxPlayersPerHWID = 0
# ---------------------------------------------------------------------------
# Misc Player Settings
# ---------------------------------------------------------------------------

View File

@@ -0,0 +1,25 @@
<html><title>Hardware Information: %name%</title><body>
<center>
<table width=290>
<tr>
<td width=45><button value="Main" action="bypass -h admin_admin" width=45 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td width=180><center>Hardware (%name%)</center></td>
<td width=45><button value="Back" action="bypass -h admin_admin7" width=45 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
</table>
<br>
<table width=290 border=0>
<tr><td><table width=290 border=0 bgcolor=131210><tr><td width=100><font color="LEVEL">MAC Address:</font></td><td align=right width=170>%macAddress%</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><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><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 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><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 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><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 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>
</center>
</body></html>

View File

@@ -35,6 +35,9 @@
<td>Account IP: </td><td><font color="LEVEL"><a action="bypass -h admin_find_ip %ip%">%ip%</a></font></td>
</tr>
<tr>
<td>Hardware MAC: </td><td><font color="LEVEL"><a action="bypass -h admin_hwid">%hwid%</a></font></td>
</tr>
<tr>
<td>Punishment: </td><td><font color="LEVEL"><a action="bypass -h admin_punishment player %name%">Info</a></font></td>
</tr>
</table>

View File

@@ -86,6 +86,7 @@ import handlers.admincommandhandlers.AdminGraciaSeeds;
import handlers.admincommandhandlers.AdminGrandBoss;
import handlers.admincommandhandlers.AdminHeal;
import handlers.admincommandhandlers.AdminHtml;
import handlers.admincommandhandlers.AdminHwid;
import handlers.admincommandhandlers.AdminInstance;
import handlers.admincommandhandlers.AdminInstanceZone;
import handlers.admincommandhandlers.AdminInvul;
@@ -363,6 +364,7 @@ public class MasterHandler
AdminGrandBoss.class,
AdminHeal.class,
AdminHtml.class,
AdminHwid.class,
AdminInstance.class,
AdminInstanceZone.class,
AdminInvul.class,

View File

@@ -1160,6 +1160,7 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%access%", player.getAccessLevel().getLevel() + " (" + player.getAccessLevel().getName() + ")");
adminReply.replace("%account%", player.getAccountName());
adminReply.replace("%ip%", ip);
adminReply.replace("%hwid%", (player.getClient() != null) && (player.getClient().getHardwareInfo() != null) ? player.getClient().getHardwareInfo().getMacAddress() : "Unknown");
adminReply.replace("%ai%", String.valueOf(player.getAI().getIntention().name()));
adminReply.replace("%inst%", player.isInInstance() ? "<tr><td>InstanceId:</td><td><a action=\"bypass -h admin_instance_spawns " + String.valueOf(player.getInstanceId()) + "\">" + String.valueOf(player.getInstanceId()) + "</a></td></tr>" : "");
adminReply.replace("%noblesse%", player.isNoble() ? "Yes" : "No");

View File

@@ -0,0 +1,66 @@
/*
* 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.admincommandhandlers;
import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
/**
* @author Mobius
*/
public class AdminHwid implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_hwid",
"admin_hwinfo"
};
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if ((activeChar.getTarget() == null) || !activeChar.getTarget().isPlayer() || (activeChar.getTarget().getActingPlayer().getClient() == null) || (activeChar.getTarget().getActingPlayer().getClient().getHardwareInfo() == null))
{
return true;
}
final L2PcInstance target = activeChar.getTarget().getActingPlayer();
final NpcHtmlMessage html = new NpcHtmlMessage(0, 1);
html.setHtml(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/admin/charhwinfo.htm"));
html.replace("%name%", target.getName());
html.replace("%macAddress%", target.getClient().getHardwareInfo().getMacAddress());
html.replace("%windowsPlatformId%", target.getClient().getHardwareInfo().getWindowsPlatformId());
html.replace("%windowsMajorVersion%", target.getClient().getHardwareInfo().getWindowsMajorVersion());
html.replace("%windowsMinorVersion%", target.getClient().getHardwareInfo().getWindowsMinorVersion());
html.replace("%windowsBuildNumber%", target.getClient().getHardwareInfo().getWindowsBuildNumber());
html.replace("%cpuName%", target.getClient().getHardwareInfo().getCpuName());
html.replace("%cpuSpeed%", target.getClient().getHardwareInfo().getCpuSpeed());
html.replace("%cpuCoreCount%", target.getClient().getHardwareInfo().getCpuCoreCount());
html.replace("%vgaVersion%", target.getClient().getHardwareInfo().getVgaVersion());
html.replace("%vgaName%", target.getClient().getHardwareInfo().getVgaName());
html.replace("%vgaDriverVersion%", target.getClient().getHardwareInfo().getVgaDriverVersion());
activeChar.sendPacket(html);
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
}