Sync LoginServer changes from L2jUnity.

This commit is contained in:
MobiusDev
2016-06-04 18:02:32 +00:00
parent 2d6440aafd
commit e003e87887
18 changed files with 278 additions and 92 deletions

View File

@@ -0,0 +1,29 @@
/*
* 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 com.l2jmobius.loginserver.network.serverpackets;
/**
* @author UnAfraid
*/
public class LoginOtpFail extends L2LoginServerPacket
{
@Override
protected void write()
{
writeC(0x0D);
}
}

View File

@@ -0,0 +1,40 @@
/*
* 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 com.l2jmobius.loginserver.network.serverpackets;
/**
* @author UnAfraid
*/
public class PIAgreementAck extends L2LoginServerPacket
{
private final int _accountId;
private final int _status;
public PIAgreementAck(int accountId, int status)
{
_accountId = accountId;
_status = status;
}
@Override
protected void write()
{
writeC(0x12);
writeD(_accountId);
writeC(_status);
}
}

View File

@@ -0,0 +1,40 @@
/*
* 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 com.l2jmobius.loginserver.network.serverpackets;
/**
* @author UnAfraid
*/
public class PIAgreementCheck extends L2LoginServerPacket
{
private final int _accountId;
private final int _status;
public PIAgreementCheck(int accountId, int status)
{
_accountId = accountId;
_status = status;
}
@Override
protected void write()
{
writeC(0x11);
writeD(_accountId);
writeC(_status);
}
}

View File

@@ -63,7 +63,6 @@ public final class ServerList extends L2LoginServerPacket
private final List<ServerData> _servers;
private final int _lastServer;
private final Map<Integer, Integer> _charsOnServers;
private final Map<Integer, long[]> _charsToDelete;
class ServerData
{
@@ -103,7 +102,7 @@ public final class ServerList extends L2LoginServerPacket
_ageLimit = 0;
_brackets = gsi.isShowingBrackets();
// If server GM-only - show status only to GMs
_status = (gsi.getStatus() == ServerStatus.STATUS_GM_ONLY) && (client.getAccessLevel() <= 0) ? ServerStatus.STATUS_DOWN : gsi.getStatus();
_status = gsi.getStatus() != ServerStatus.STATUS_GM_ONLY ? gsi.getStatus() : client.getAccessLevel() > 0 ? gsi.getStatus() : ServerStatus.STATUS_DOWN;
_serverId = gsi.getId();
}
}
@@ -117,7 +116,6 @@ public final class ServerList extends L2LoginServerPacket
_servers.add(new ServerData(client, gsi));
}
_charsOnServers = client.getCharsOnServ();
_charsToDelete = client.getCharsWaitingDelOnServ();
}
@Override
@@ -144,31 +142,14 @@ public final class ServerList extends L2LoginServerPacket
writeD(server._serverType); // 1: Normal, 2: Relax, 4: Public Test, 8: No Label, 16: Character Creation Restricted, 32: Event, 64: Free
writeC(server._brackets ? 0x01 : 0x00);
}
writeH(0x00); // unknown
writeH(0xA4); // unknown
if (_charsOnServers != null)
{
writeC(_charsOnServers.size());
for (int servId : _charsOnServers.keySet())
for (ServerData server : _servers)
{
writeC(servId);
writeC(_charsOnServers.get(servId));
if ((_charsToDelete == null) || !_charsToDelete.containsKey(servId))
{
writeC(0x00);
}
else
{
writeC(_charsToDelete.get(servId).length);
for (long deleteTime : _charsToDelete.get(servId))
{
writeD((int) ((deleteTime - System.currentTimeMillis()) / 1000));
}
}
writeC(server._serverId);
writeC(_charsOnServers.getOrDefault(server._serverId, 0));
}
}
else
{
writeC(0x00);
}
}
}