From 4bacaa84f2c0b7de1b3e1a881e596afc051236d7 Mon Sep 17 00:00:00 2001 From: Zing Date: Sat, 16 Aug 2014 22:30:57 -0700 Subject: [PATCH 1/2] Fixed Some Admin commands not working on file systems other than windows. --- scripts/commands/broadcastGalaxy.py | 13 --------- scripts/commands/broadcastPlanet.py | 12 --------- scripts/commands/createCreature.py | 21 --------------- scripts/commands/getStationName.py | 16 ----------- scripts/commands/setRank.py | 41 ----------------------------- 5 files changed, 103 deletions(-) delete mode 100644 scripts/commands/broadcastGalaxy.py delete mode 100644 scripts/commands/broadcastPlanet.py delete mode 100644 scripts/commands/createCreature.py delete mode 100644 scripts/commands/getStationName.py delete mode 100644 scripts/commands/setRank.py diff --git a/scripts/commands/broadcastGalaxy.py b/scripts/commands/broadcastGalaxy.py deleted file mode 100644 index 990c80ef..00000000 --- a/scripts/commands/broadcastGalaxy.py +++ /dev/null @@ -1,13 +0,0 @@ - -from services.sui import SUIWindow -from services.sui.SUIWindow import Trigger -from java.util import Vector -import sys - -def setup(): - return - -def run(core, actor, target, commandString): - core.chatService.broadcastGalaxy(commandString) - actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF broadcastGalaxy: Command completed successfully.', 0) - return \ No newline at end of file diff --git a/scripts/commands/broadcastPlanet.py b/scripts/commands/broadcastPlanet.py deleted file mode 100644 index da40f608..00000000 --- a/scripts/commands/broadcastPlanet.py +++ /dev/null @@ -1,12 +0,0 @@ -from services.sui import SUIWindow -from services.sui.SUIWindow import Trigger -from java.util import Vector -import sys - -def setup(): - return - -def run(core, actor, target, commandString): - core.chatService.broadcastPlanet(commandString, actor.getPlanet()) - actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF broadcastPlanet: Command completed successfully.', 0) - return \ No newline at end of file diff --git a/scripts/commands/createCreature.py b/scripts/commands/createCreature.py deleted file mode 100644 index e8adeeec..00000000 --- a/scripts/commands/createCreature.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys - -def run(core, actor, target, commandString): - - commandArgs = commandString.split(' ') - arg1 = commandArgs[0] - if len(commandArgs) > 1: - arg2 = commandArgs[1] - - if len(commandArgs) > 1: - pos = actor.getWorldPosition() - core.spawnService.spawnCreature(arg1, actor.getPlanet().getName(), 0, pos.x, pos.y, pos.z, 1, 0, 1, 0, int(arg2)) - actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF createCreature: Command completed successfully.' , 0) - return - - else: - actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF createCreature: Invalid Syntax. Syntax is: /createcreature .', 0) - return - - - return \ No newline at end of file diff --git a/scripts/commands/getStationName.py b/scripts/commands/getStationName.py deleted file mode 100644 index 57ca7fdb..00000000 --- a/scripts/commands/getStationName.py +++ /dev/null @@ -1,16 +0,0 @@ -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 ', 0) - return \ No newline at end of file diff --git a/scripts/commands/setRank.py b/scripts/commands/setRank.py deleted file mode 100644 index 8ea9d2a7..00000000 --- a/scripts/commands/setRank.py +++ /dev/null @@ -1,41 +0,0 @@ -import sys -from resources.datatables import GcwRank -from services.gcw import GCWService - -def run(core, actor, target, commandString): - commandArgs = commandString.split(' ') - arg1 = commandArgs[0] - if len(commandArgs) > 1: - arg2 = commandArgs[1] - - if target is None: - target = actor - - if target.getFaction() == 'rebel' or 'imperial' and arg1 == 'up': - playerObject = target.getSlottedObject('ghost') - playerObject.setCurrentRank(int(arg2)) - newrank = playerObject.getCurrentRank() - core.scriptService.callScript("scripts/collections/", "gcwrank_" + target.getFaction(), "handleRankUp", core, target, newrank) - actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF setRank: Command completed successfully.', 0) - if target.getFaction() == 'rebel' or 'imperial' and arg1 == 'down': - playerObject = target.getSlottedObject('ghost') - playerObject.setCurrentRank(int(arg2)) - newrank = playerObject.getCurrentRank() - core.scriptService.callScript("scripts/collections/", "gcwrank_" + target.getFaction(), "handleRankDown", target, newrank) - actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF setRank: Command completed successfully.', 0) - -# if target.getFaction() == 'imperial' and arg1 == 'up': -# if arg1 == 'up': -# playerObject = actor.getSlottedObject('ghost') -# playerObject.setCurrentRank(int(arg2)) -# newrank = playerObject.getCurrentRank() -# core.scriptService.callScript("scripts/collections/", "gcwrank_" + target.getFaction(), "handleRankUp", core, target, newrank) -# actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF setRank: Command completed successfully.', 0) -# if target.getFaction() == 'imperial' and arg1 == 'down': -# playerObject = actor.getSlottedObject('ghost') -# playerObject.setCurrentRank(int(arg2)) -# newrank = playerObject.getCurrentRank() -# core.scriptService.callScript("scripts/collections/", "gcwrank_" + target.getFaction(), "handleRankDown", target, newrank) -# actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF setRank: Command completed successfully.', 0) - - return \ No newline at end of file From 882cba71cd699e6e68a29b15bd4276353172fe62 Mon Sep 17 00:00:00 2001 From: Zing Date: Sat, 16 Aug 2014 22:36:36 -0700 Subject: [PATCH 2/2] Fixed Some admin commands part 2 Added godLevel 0 admin commands to block. --- scripts/commands/broadcastgalaxy.py | 13 ++++++++ scripts/commands/broadcastplanet.py | 12 +++++++ scripts/commands/createcreature.py | 21 ++++++++++++ scripts/commands/getstationname.py | 16 +++++++++ scripts/commands/setrank.py | 41 ++++++++++++++++++++++++ src/services/command/CommandService.java | 2 +- 6 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 scripts/commands/broadcastgalaxy.py create mode 100644 scripts/commands/broadcastplanet.py create mode 100644 scripts/commands/createcreature.py create mode 100644 scripts/commands/getstationname.py create mode 100644 scripts/commands/setrank.py diff --git a/scripts/commands/broadcastgalaxy.py b/scripts/commands/broadcastgalaxy.py new file mode 100644 index 00000000..990c80ef --- /dev/null +++ b/scripts/commands/broadcastgalaxy.py @@ -0,0 +1,13 @@ + +from services.sui import SUIWindow +from services.sui.SUIWindow import Trigger +from java.util import Vector +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + core.chatService.broadcastGalaxy(commandString) + actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF broadcastGalaxy: Command completed successfully.', 0) + return \ No newline at end of file diff --git a/scripts/commands/broadcastplanet.py b/scripts/commands/broadcastplanet.py new file mode 100644 index 00000000..da40f608 --- /dev/null +++ b/scripts/commands/broadcastplanet.py @@ -0,0 +1,12 @@ +from services.sui import SUIWindow +from services.sui.SUIWindow import Trigger +from java.util import Vector +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + core.chatService.broadcastPlanet(commandString, actor.getPlanet()) + actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF broadcastPlanet: Command completed successfully.', 0) + return \ No newline at end of file diff --git a/scripts/commands/createcreature.py b/scripts/commands/createcreature.py new file mode 100644 index 00000000..e8adeeec --- /dev/null +++ b/scripts/commands/createcreature.py @@ -0,0 +1,21 @@ +import sys + +def run(core, actor, target, commandString): + + commandArgs = commandString.split(' ') + arg1 = commandArgs[0] + if len(commandArgs) > 1: + arg2 = commandArgs[1] + + if len(commandArgs) > 1: + pos = actor.getWorldPosition() + core.spawnService.spawnCreature(arg1, actor.getPlanet().getName(), 0, pos.x, pos.y, pos.z, 1, 0, 1, 0, int(arg2)) + actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF createCreature: Command completed successfully.' , 0) + return + + else: + actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF createCreature: Invalid Syntax. Syntax is: /createcreature .', 0) + return + + + return \ No newline at end of file diff --git a/scripts/commands/getstationname.py b/scripts/commands/getstationname.py new file mode 100644 index 00000000..57ca7fdb --- /dev/null +++ b/scripts/commands/getstationname.py @@ -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 ', 0) + return \ No newline at end of file diff --git a/scripts/commands/setrank.py b/scripts/commands/setrank.py new file mode 100644 index 00000000..8ea9d2a7 --- /dev/null +++ b/scripts/commands/setrank.py @@ -0,0 +1,41 @@ +import sys +from resources.datatables import GcwRank +from services.gcw import GCWService + +def run(core, actor, target, commandString): + commandArgs = commandString.split(' ') + arg1 = commandArgs[0] + if len(commandArgs) > 1: + arg2 = commandArgs[1] + + if target is None: + target = actor + + if target.getFaction() == 'rebel' or 'imperial' and arg1 == 'up': + playerObject = target.getSlottedObject('ghost') + playerObject.setCurrentRank(int(arg2)) + newrank = playerObject.getCurrentRank() + core.scriptService.callScript("scripts/collections/", "gcwrank_" + target.getFaction(), "handleRankUp", core, target, newrank) + actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF setRank: Command completed successfully.', 0) + if target.getFaction() == 'rebel' or 'imperial' and arg1 == 'down': + playerObject = target.getSlottedObject('ghost') + playerObject.setCurrentRank(int(arg2)) + newrank = playerObject.getCurrentRank() + core.scriptService.callScript("scripts/collections/", "gcwrank_" + target.getFaction(), "handleRankDown", target, newrank) + actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF setRank: Command completed successfully.', 0) + +# if target.getFaction() == 'imperial' and arg1 == 'up': +# if arg1 == 'up': +# playerObject = actor.getSlottedObject('ghost') +# playerObject.setCurrentRank(int(arg2)) +# newrank = playerObject.getCurrentRank() +# core.scriptService.callScript("scripts/collections/", "gcwrank_" + target.getFaction(), "handleRankUp", core, target, newrank) +# actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF setRank: Command completed successfully.', 0) +# if target.getFaction() == 'imperial' and arg1 == 'down': +# playerObject = actor.getSlottedObject('ghost') +# playerObject.setCurrentRank(int(arg2)) +# newrank = playerObject.getCurrentRank() +# core.scriptService.callScript("scripts/collections/", "gcwrank_" + target.getFaction(), "handleRankDown", target, newrank) +# actor.sendSystemMessage(' \\#FE2EF7 [GM] \\#FFFFFF setRank: Command completed successfully.', 0) + + return \ No newline at end of file diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 4126b474..acf53906 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -691,7 +691,7 @@ 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") || command.getCommandName().equals("server") || command.getCommandName().equals("teleport") - || command.getCommandName().equals("teleportto") || command.getCommandName().equals("teleporttarget") ) { + || command.getCommandName().equals("teleportto") || command.getCommandName().equals("teleporttarget") || command.getCommandName().equals("createcreature") || command.getCommandName().equals("giveitem") ) { String accessLevel = core.adminService.getAccessLevelFromDB(actor.getClient().getAccountId()); String filePath = "accesslevels/" + accessLevel + ".txt"; System.out.println(command.getCommandName() + " was just used by an admin with accessLevel: " + accessLevel + ".");