mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-08 08:23:11 +00:00
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver 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.
|
||||
*
|
||||
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Blowfish keygen for GameServer client connections
|
||||
*
|
||||
* @author KenM
|
||||
*/
|
||||
public class BlowFishKeygen {
|
||||
private static final int CRYPT_KEYS_SIZE = 20;
|
||||
private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16];
|
||||
|
||||
private static final Random random = new Random();
|
||||
|
||||
static {
|
||||
// init the GS encryption keys on class load
|
||||
|
||||
for (int i = 0; i < CRYPT_KEYS_SIZE; i++) {
|
||||
// randomize the 8 first bytes
|
||||
for (int j = 0; j < CRYPT_KEYS[i].length; j++) {
|
||||
CRYPT_KEYS[i][j] = (byte) random.nextInt(255);
|
||||
}
|
||||
|
||||
// the last 8 bytes are static
|
||||
CRYPT_KEYS[i][8] = (byte) 0xc8;
|
||||
CRYPT_KEYS[i][9] = (byte) 0x27;
|
||||
CRYPT_KEYS[i][10] = (byte) 0x93;
|
||||
CRYPT_KEYS[i][11] = (byte) 0x01;
|
||||
CRYPT_KEYS[i][12] = (byte) 0xa1;
|
||||
CRYPT_KEYS[i][13] = (byte) 0x6c;
|
||||
CRYPT_KEYS[i][14] = (byte) 0x31;
|
||||
CRYPT_KEYS[i][15] = (byte) 0x97;
|
||||
}
|
||||
}
|
||||
|
||||
// block instantiation
|
||||
private BlowFishKeygen() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a key from this keygen pool, the logical ownership is retained by
|
||||
* this keygen.<BR>
|
||||
* Thus when getting a key with interests other then read-only a copy must
|
||||
* be performed.<BR>
|
||||
*
|
||||
* @return A key from this keygen pool.
|
||||
*/
|
||||
public static byte[] getRandomKey() {
|
||||
return CRYPT_KEYS[random.nextInt(CRYPT_KEYS_SIZE)];
|
||||
}
|
||||
}
|
||||
@@ -13,23 +13,6 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver 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.
|
||||
*
|
||||
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.util;
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
*/
|
||||
package com.l2jserver.util.dimensional;
|
||||
|
||||
import org.apache.commons.math.geometry.Rotation;
|
||||
|
||||
/**
|
||||
* An point is composed of an Coordinate and an angle. The angle represents the
|
||||
* facing angle of the point, that is, the direction the point is "looking".
|
||||
@@ -30,9 +28,9 @@ public class Point {
|
||||
*/
|
||||
protected final Coordinate coordinate;
|
||||
/**
|
||||
* Te point rotation
|
||||
* The point angle
|
||||
*/
|
||||
protected final Rotation rotation;
|
||||
protected final double angle;
|
||||
|
||||
/**
|
||||
* Creates a new point
|
||||
@@ -44,7 +42,7 @@ public class Point {
|
||||
*/
|
||||
public Point(Coordinate coordinate, double angle) {
|
||||
this.coordinate = coordinate;
|
||||
this.rotation = new Rotation(coordinate.vector, angle);
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,21 +91,9 @@ public class Point {
|
||||
|
||||
/**
|
||||
* @return the angle
|
||||
* @see org.apache.commons.math.geometry.Rotation#getAngle()
|
||||
*/
|
||||
public double getAngle() {
|
||||
return rotation.getAngle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other
|
||||
* the other point
|
||||
* @return the angle difference between the two points
|
||||
* @see org.apache.commons.math.geometry.Rotation#distance(Rotation,
|
||||
* Rotation)
|
||||
*/
|
||||
public double getAngleDifference(Point other) {
|
||||
return Rotation.distance(this.rotation, other.rotation);
|
||||
return angle;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,13 +103,6 @@ public class Point {
|
||||
return coordinate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rotation
|
||||
*/
|
||||
public Rotation getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance from the 3 points and an angle
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user