More work on combat, added 2 obj Controller packets, added /setspeed, fixed object permissions

This commit is contained in:
Light2
2013-08-03 23:23:35 +02:00
parent 019e8a712b
commit 8c6d56bef3
14 changed files with 621 additions and 23 deletions
+23 -2
View File
@@ -22,6 +22,8 @@
package main;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
@@ -38,6 +40,7 @@ import services.ScriptService;
import services.SimulationService;
import services.TerrainService;
import services.chat.ChatService;
import services.combat.CombatService;
import services.command.CombatCommand;
import services.command.CommandService;
import services.gcw.GCWService;
@@ -102,6 +105,7 @@ public class NGECore {
public GuildService guildService;
public GCWService gcwService;
public TradeService tradeService;
public CombatService combatService;
// Login Server
public NetworkDispatch loginDispatch;
@@ -130,7 +134,7 @@ public class NGECore {
databaseConnection.connect(config.getString("DB.URL"), config.getString("DB.NAME"), config.getString("DB.USER"), config.getString("DB.PASS"), "postgresql");
databaseConnection2 = new DatabaseConnection();
setGalaxyStatus(1);
creatureODB = new ObjectDatabase("creature", true, false, true);
mailODB = new ObjectDatabase("mails", true, false, true);
@@ -148,7 +152,7 @@ public class NGECore {
chatService = new ChatService(this);
attributeService = new AttributeService(this);
suiService = new SUIService(this);
combatService = new CombatService(this);
// Ping Server
try {
PingServer pingServer = new PingServer(config.getInt("PING.PORT"));
@@ -197,6 +201,8 @@ public class NGECore {
didServerCrash = false;
System.out.println("Started Server.");
setGalaxyStatus(2);
}
@@ -249,6 +255,21 @@ public class NGECore {
}
public void setGalaxyStatus(int statusId) {
int galaxyId = config.getInt("GALAXY_ID");
try {
PreparedStatement ps = databaseConnection.preparedStatement("UPDATE \"connectionServers\" SET \"statusId\"=? WHERE \"galaxyId\"=?");
ps.setInt(1, statusId);
ps.setInt(2, galaxyId);
ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
/*
* ---------- Getter methods for NGECore ----------
*/