From 6de085b3daa45debe9fd1e17e2542c6ea40c723d Mon Sep 17 00:00:00 2001 From: Zing Date: Sun, 17 Aug 2014 01:18:34 -0700 Subject: [PATCH] Fixed Admin commands part2 --- 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 88239133..64ccb8cc 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -689,7 +689,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 + ".");