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

@@ -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;
}
}