This commit is contained in:
Waverunner
2014-08-16 11:42:31 -04:00
5 changed files with 45 additions and 13 deletions
+16
View File
@@ -0,0 +1,16 @@
import sys
import main.NGECore
import services.AdminService
def setup():
return
def run(core, actor, target, commandString):
if target:
actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF Command Completed Successfully: Account name for target is ' + core.adminService.getAccountNameFromDB(target.getClient().getAccountId()) + '.', 0)
else:
actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF getStationName: Invalid Syntax. Syntax is: /getStationName <Character First Name>', 0)
return
@@ -154,17 +154,16 @@ public class WaypointObject extends IntangibleObject implements IDelta, Serializ
}
public synchronized byte[] getBytes() {
IoBuffer buffer = Baseline.createBuffer(38 + StringUtilities.getUnicodeString(getName()).length);
buffer.putInt(getCellNumber());
buffer.put(Baseline.toBytes(getBaseline(3).get("position")));
buffer.putLong(getTargetId());
buffer.putInt(getPlanetCrc());
buffer.put(StringUtilities.getUnicodeString(getName()));
buffer.putLong(getObjectID());
buffer.put(getColor());
buffer.put(Baseline.getBoolean(isActive()));
return buffer.flip().array();
IoBuffer buffer = Baseline.createBuffer(38 + StringUtilities.getUnicodeString(getName()).length);
buffer.putInt(getCellNumber());
buffer.put(Baseline.toBytes(getBaseline(3).get("position")));
buffer.putLong(getTargetId());
buffer.putInt(getPlanetCrc());
buffer.put(StringUtilities.getUnicodeString(getName()));
buffer.putLong(getObjectID());
buffer.put(getColor());
buffer.put(Baseline.getBoolean(isActive()));
return buffer.flip().array();
}
@Deprecated public int getCellId() { return getCellNumber(); }
+16
View File
@@ -55,6 +55,22 @@ public class AdminService implements INetworkDispatch {
return accessLevel;
}
public String getAccountNameFromDB(long id) {
String accountName = null;
PreparedStatement preparedStatement;
try {
preparedStatement = NGECore.getInstance().getDatabase1().preparedStatement("SELECT * FROM accounts WHERE id=" + id + "");
ResultSet resultSet = preparedStatement.executeQuery();
if(resultSet.next())
accountName = resultSet.getString("user");
} catch (SQLException e) {
e.printStackTrace();
}
return accountName;
}
@Override
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> arg0, Map<Integer, INetworkRemoteEvent> arg1) {
+1 -1
View File
@@ -526,7 +526,7 @@ public class PlayerService implements INetworkDispatch {
});
swgOpcodes.put(Opcodes.CmdSceneReady, (session, data) -> {
session.setAttribute("CmdSceneReady", true);
});
/*swgOpcodes.put(Opcodes.ExpertiseRequestMessage, new INetworkRemoteEvent() {
+2 -1
View File
@@ -688,7 +688,8 @@ public class CommandService implements INetworkDispatch {
public void processCommand(CreatureObject actor, SWGObject target, BaseSWGCommand command, int actionCounter, String commandArgs) {
if (command.getGodLevel() > 0 || command.getCommandName().equals("setgodmode")) {
if (command.getGodLevel() > 0 || command.getCommandName().equals("setgodmode") || command.getCommandName().equals("server") || command.getCommandName().equals("teleport")
|| command.getCommandName().equals("teleportto") || command.getCommandName().equals("teleporttarget") ) {
String accessLevel = core.adminService.getAccessLevelFromDB(actor.getClient().getAccountId());
String filePath = "accesslevels/" + accessLevel + ".txt";