Added xp gain on killing NPCs, fixed some bugs, added 2 new config options

This commit is contained in:
Light2
2014-03-26 23:37:10 +01:00
parent d1a7f20177
commit c3772e3246
27 changed files with 228 additions and 208 deletions
+5 -7
View File
@@ -25,6 +25,7 @@ import java.nio.ByteOrder;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -45,7 +46,6 @@ import protocol.swg.ConnectionServerLagResponse;
import protocol.swg.GalaxyLoopTimesResponse;
import protocol.swg.GameServerLagResponse;
import protocol.swg.HeartBeatMessage;
import engine.clients.Client;
import engine.resources.database.DatabaseConnection;
import engine.resources.scene.Point3D;
@@ -64,7 +64,7 @@ public class ConnectionService implements INetworkDispatch {
private NGECore core;
private DatabaseConnection databaseConnection;
private DatabaseConnection databaseConnection2;
private int maxNumberOfCharacters;
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
public ConnectionService(final NGECore core) {
@@ -72,6 +72,7 @@ public class ConnectionService implements INetworkDispatch {
this.core = core;
this.databaseConnection = core.getDatabase1();
this.databaseConnection2 = core.getDatabase2();
this.maxNumberOfCharacters = core.getConfig().getInt("MAXNUMBEROFCHARACTERS");
scheduler.scheduleAtFixedRate(new Runnable() {
@@ -125,7 +126,7 @@ public class ConnectionService implements INetworkDispatch {
client.setSessionKey(clientIdMsg.getSessionKey());
client.setGM(core.loginService.checkForGmPermission((int) resultSet.getLong("accountId")));
AccountFeatureBits accountFeatureBits = new AccountFeatureBits();
ClientPermissionsMessage clientPermissionsMessage = new ClientPermissionsMessage(2 - core.characterService.getNumberOfCharacters((int) resultSet.getLong("accountId")));
ClientPermissionsMessage clientPermissionsMessage = new ClientPermissionsMessage(maxNumberOfCharacters - core.characterService.getNumberOfCharacters((int) resultSet.getLong("accountId")));
session.write(new HeartBeatMessage().serialize());
session.write(accountFeatureBits.serialize());
session.write(clientPermissionsMessage.serialize());
@@ -232,10 +233,7 @@ public class ConnectionService implements INetworkDispatch {
List<AbstractCollidable> collidables = core.simulationService.getCollidables(object.getPlanet(), objectPos.x, objectPos.z, 512);
for(AbstractCollidable collidable : collidables) {
collidables.remove(object);
}
collidables.forEach(c -> c.removeCollidedObject(object));
if (ghost != null) {
String objectShortName = object.getCustomName();