Project update.

This commit is contained in:
MobiusDev
2015-12-31 23:53:41 +00:00
parent e0d681a17e
commit ad2bcd79be
4084 changed files with 83696 additions and 86998 deletions

View File

@ -0,0 +1,60 @@
/*
* 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.gameserver.network.gameserverpackets;
import java.util.List;
import com.l2jmobius.util.network.BaseSendablePacket;
public class AuthRequest extends BaseSendablePacket
{
/**
* Format: cccSddb c desired ID c accept alternative ID c reserve Host s ExternalHostName s InetranlHostName d max players d hexid size b hexid
* @param id
* @param acceptAlternate
* @param hexid
* @param port
* @param reserveHost
* @param maxplayer
* @param subnets the subnets lists
* @param hosts the hosts list
*/
public AuthRequest(int id, boolean acceptAlternate, byte[] hexid, int port, boolean reserveHost, int maxplayer, List<String> subnets, List<String> hosts)
{
writeC(0x01);
writeC(id);
writeC(acceptAlternate ? 0x01 : 0x00);
writeC(reserveHost ? 0x01 : 0x00);
writeH(port);
writeD(maxplayer);
writeD(hexid.length);
writeB(hexid);
writeD(subnets.size());
for (int i = 0; i < subnets.size(); i++)
{
writeS(subnets.get(i));
writeS(hosts.get(i));
}
}
@Override
public byte[] getContent()
{
return getBytes();
}
}

View File

@ -0,0 +1,60 @@
/*
* 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.gameserver.network.gameserverpackets;
import java.security.interfaces.RSAPublicKey;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.crypto.Cipher;
import com.l2jmobius.util.network.BaseSendablePacket;
/**
* @author -Wooden-
*/
public class BlowFishKey extends BaseSendablePacket
{
private static Logger _log = Logger.getLogger(BlowFishKey.class.getName());
/**
* @param blowfishKey
* @param publicKey
*/
public BlowFishKey(byte[] blowfishKey, RSAPublicKey publicKey)
{
writeC(0x00);
try
{
final Cipher rsaCipher = Cipher.getInstance("RSA/ECB/nopadding");
rsaCipher.init(Cipher.ENCRYPT_MODE, publicKey);
final byte[] encrypted = rsaCipher.doFinal(blowfishKey);
writeD(encrypted.length);
writeB(encrypted);
}
catch (Exception e)
{
_log.log(Level.SEVERE, "Error While encrypting blowfish key for transmision (Crypt error): " + e.getMessage(), e);
}
}
@Override
public byte[] getContent()
{
return getBytes();
}
}

View File

@ -0,0 +1,38 @@
/*
* 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.gameserver.network.gameserverpackets;
import com.l2jmobius.util.network.BaseSendablePacket;
/**
* @author -Wooden-
*/
public class ChangeAccessLevel extends BaseSendablePacket
{
public ChangeAccessLevel(String player, int access)
{
writeC(0x04);
writeD(access);
writeS(player);
}
@Override
public byte[] getContent()
{
return getBytes();
}
}

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.gameserver.network.gameserverpackets;
import com.l2jmobius.util.network.BaseSendablePacket;
/**
* @author UnAfraid
*/
public class ChangePassword extends BaseSendablePacket
{
public ChangePassword(String accountName, String characterName, String oldPass, String newPass)
{
writeC(0x0B);
writeS(accountName);
writeS(characterName);
writeS(oldPass);
writeS(newPass);
}
@Override
public byte[] getContent()
{
return getBytes();
}
}

View File

@ -0,0 +1,42 @@
/*
* 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.gameserver.network.gameserverpackets;
import com.l2jmobius.gameserver.LoginServerThread.SessionKey;
import com.l2jmobius.util.network.BaseSendablePacket;
/**
* @author -Wooden-
*/
public class PlayerAuthRequest extends BaseSendablePacket
{
public PlayerAuthRequest(String account, SessionKey key)
{
writeC(0x05);
writeS(account);
writeD(key.playOkID1);
writeD(key.playOkID2);
writeD(key.loginOkID1);
writeD(key.loginOkID2);
}
@Override
public byte[] getContent()
{
return getBytes();
}
}

View File

@ -0,0 +1,50 @@
/*
* 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.gameserver.network.gameserverpackets;
import java.util.List;
import com.l2jmobius.util.network.BaseSendablePacket;
/**
* @author -Wooden-
*/
public class PlayerInGame extends BaseSendablePacket
{
public PlayerInGame(String player)
{
writeC(0x02);
writeH(1);
writeS(player);
}
public PlayerInGame(List<String> players)
{
writeC(0x02);
writeH(players.size());
for (String pc : players)
{
writeS(pc);
}
}
@Override
public byte[] getContent()
{
return getBytes();
}
}

View File

@ -0,0 +1,37 @@
/*
* 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.gameserver.network.gameserverpackets;
import com.l2jmobius.util.network.BaseSendablePacket;
/**
* @author -Wooden-
*/
public class PlayerLogout extends BaseSendablePacket
{
public PlayerLogout(String player)
{
writeC(0x03);
writeS(player);
}
@Override
public byte[] getContent()
{
return getBytes();
}
}

View File

@ -0,0 +1,42 @@
/*
* 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.gameserver.network.gameserverpackets;
import com.l2jmobius.util.network.BaseSendablePacket;
/**
* @author mrTJO
*/
public class PlayerTracert extends BaseSendablePacket
{
public PlayerTracert(String account, String pcIp, String hop1, String hop2, String hop3, String hop4)
{
writeC(0x07);
writeS(account);
writeS(pcIp);
writeS(hop1);
writeS(hop2);
writeS(hop3);
writeS(hop4);
}
@Override
public byte[] getContent()
{
return getBytes();
}
}

View File

@ -0,0 +1,46 @@
/*
* 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.gameserver.network.gameserverpackets;
import java.util.List;
import com.l2jmobius.util.network.BaseSendablePacket;
/**
* @author mrTJO Thanks to mochitto
*/
public class ReplyCharacters extends BaseSendablePacket
{
public ReplyCharacters(String account, int chars, List<Long> timeToDel)
{
writeC(0x08);
writeS(account);
writeC(chars);
writeC(timeToDel.size());
for (long time : timeToDel)
{
writeQ(time);
}
}
@Override
public byte[] getContent()
{
return getBytes();
}
}

View File

@ -0,0 +1,43 @@
/*
* 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.gameserver.network.gameserverpackets;
import com.l2jmobius.util.network.BaseSendablePacket;
/**
* @author mrTJO
*/
public class SendMail extends BaseSendablePacket
{
public SendMail(String accountName, String mailId, String... args)
{
writeC(0x09);
writeS(accountName);
writeS(mailId);
writeC(args.length);
for (String arg : args)
{
writeS(arg);
}
}
@Override
public byte[] getContent()
{
return getBytes();
}
}

View File

@ -0,0 +1,106 @@
/*
* 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.gameserver.network.gameserverpackets;
import java.util.ArrayList;
import com.l2jmobius.util.network.BaseSendablePacket;
/**
* @author -Wooden-
*/
public class ServerStatus extends BaseSendablePacket
{
private final ArrayList<Attribute> _attributes;
public static final String[] STATUS_STRING =
{
"Auto",
"Good",
"Normal",
"Full",
"Down",
"Gm Only"
};
public static final int SERVER_LIST_STATUS = 0x01;
public static final int SERVER_TYPE = 0x02;
public static final int SERVER_LIST_SQUARE_BRACKET = 0x03;
public static final int MAX_PLAYERS = 0x04;
public static final int SERVER_AGE = 0x05;
// Server Status
public static final int STATUS_AUTO = 0x00;
public static final int STATUS_GOOD = 0x01;
public static final int STATUS_NORMAL = 0x02;
public static final int STATUS_FULL = 0x03;
public static final int STATUS_DOWN = 0x04;
public static final int STATUS_GM_ONLY = 0x05;
// Server Types
public static final int SERVER_NORMAL = 0x01;
public static final int SERVER_RELAX = 0x02;
public static final int SERVER_TEST = 0x04;
public static final int SERVER_NOLABEL = 0x08;
public static final int SERVER_CREATION_RESTRICTED = 0x10;
public static final int SERVER_EVENT = 0x20;
public static final int SERVER_FREE = 0x40;
// Server Ages
public static final int SERVER_AGE_ALL = 0x00;
public static final int SERVER_AGE_15 = 0x0F;
public static final int SERVER_AGE_18 = 0x12;
public static final int ON = 0x01;
public static final int OFF = 0x00;
static class Attribute
{
public int id;
public int value;
Attribute(int pId, int pValue)
{
id = pId;
value = pValue;
}
}
public ServerStatus()
{
_attributes = new ArrayList<>();
}
public void addAttribute(int id, int value)
{
_attributes.add(new Attribute(id, value));
}
@Override
public byte[] getContent()
{
writeC(0x06);
writeD(_attributes.size());
for (Attribute temp : _attributes)
{
writeD(temp.id);
writeD(temp.value);
}
return getBytes();
}
}

View File

@ -0,0 +1,53 @@
/*
* 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.gameserver.network.gameserverpackets;
import com.l2jmobius.util.network.BaseSendablePacket;
/**
* @author mrTJO
*/
public class TempBan extends BaseSendablePacket
{
public TempBan(String accountName, String ip, long time, String reason)
{
writeC(0x0A);
writeS(accountName);
writeS(ip);
writeQ(System.currentTimeMillis() + (time * 60000));
if (reason != null)
{
writeC(0x01);
writeS(reason);
}
else
{
writeC(0x00);
}
}
public TempBan(String accountName, String ip, long time)
{
this(accountName, ip, time, null);
}
@Override
public byte[] getContent()
{
return getBytes();
}
}