From 3dece87a5abd6c907bbf776205060e60d22bfe6e Mon Sep 17 00:00:00 2001 From: AconiteGodOfSWG Date: Wed, 17 Mar 2021 13:03:04 -0400 Subject: [PATCH] Move generateCraftedItem to gm.cmd --- .../compiled/game/script/gm/cmd.java | 51 ++++++++++++++ .../game/script/player/player_gm.java | 69 ------------------- .../game/datatables/command/command_table.tab | 2 +- 3 files changed, 52 insertions(+), 70 deletions(-) delete mode 100755 sku.0/sys.server/compiled/game/script/player/player_gm.java diff --git a/sku.0/sys.server/compiled/game/script/gm/cmd.java b/sku.0/sys.server/compiled/game/script/gm/cmd.java index f1d46caf0..a9e031e1e 100755 --- a/sku.0/sys.server/compiled/game/script/gm/cmd.java +++ b/sku.0/sys.server/compiled/game/script/gm/cmd.java @@ -4460,4 +4460,55 @@ public class cmd extends script.base_script sendConsoleMessage(self, "\\#ffff00 ============ ============ ============ ============ \\#."); } + public int cmdGenerateCraftedItem(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException + { + if (!isGod(self)) + { + return SCRIPT_CONTINUE; + } + LOG("LOG_CHANNEL", "player_gm.generateCraftedItem commandHandler called. IsGod check passed, and handler is executing."); + debugServerConsoleMsg(self, "************ Entered cmdGenerateCraftedItem."); + java.util.StringTokenizer st = new java.util.StringTokenizer(params); + if (st.countTokens() != 2) + { + sendSystemMessageTestingOnly(self, "Did not find the correct parameters needed to create an item."); + sendSystemMessageTestingOnly(self, "/generateCraftedItem command must at least have schematic template name and attribute percentage paramaters to function."); + sendSystemMessageTestingOnly(self, "Correct usage is /generateCraftedItem "); + debugServerConsoleMsg(self, "************ Did not decode any string tokens from params passed into command handler. Unable to proceed with out at least schematic template name and attribute percentage."); + return SCRIPT_CONTINUE; + } + String template_string = ((st.nextToken())).toLowerCase(); + String schematic = ("object/draft_schematic/" + template_string + ".iff"); + String percentage_string = ((st.nextToken())).toLowerCase(); + int attributePercentage = utils.stringToInt(percentage_string); + if (attributePercentage == -1) + { + LOG("LOG_CHANNEL", "You must specify a valid item attribute percentage."); + sendSystemMessageTestingOnly(self, "You must specify a valid item attribute percentage."); + return SCRIPT_CONTINUE; + } + obj_id creationTarget = null; + if (!isIdValid(target)) + { + creationTarget = getLookAtTarget(self); + if (!isIdValid(creationTarget)) + { + creationTarget = self; + } + } + else + { + creationTarget = target; + } + obj_id inventory = utils.getInventoryContainer(creationTarget); + if (inventory != null) + { + obj_id item = makeCraftedItem(schematic, attributePercentage, inventory); + sendSystemMessageTestingOnly(self, "Item created and placed into the inventory of " + getName(creationTarget)); + CustomerServiceLog("generateCraftedItem", "Object obj_id " + item + " was created of type " + schematic + ". It was created in the inventory of object " + creationTarget + " which is named " + getName(creationTarget) + "."); + debugServerConsoleMsg(self, "Object obj_id " + item + " was created of type " + schematic + ". It was created in the inventory of object " + creationTarget + " which is named " + getName(creationTarget) + "."); + } + return SCRIPT_CONTINUE; + } + } diff --git a/sku.0/sys.server/compiled/game/script/player/player_gm.java b/sku.0/sys.server/compiled/game/script/player/player_gm.java deleted file mode 100755 index ad70fcd91..000000000 --- a/sku.0/sys.server/compiled/game/script/player/player_gm.java +++ /dev/null @@ -1,69 +0,0 @@ -package script.player; - -import script.library.utils; -import script.obj_id; -import script.string_id; - -public class player_gm extends script.base_script -{ - public player_gm() - { - } - public static final string_id SID_HEAL_DAMAGE = new string_id("sui", "heal_damage"); - public static final string_id SID_HEAL_WOUND = new string_id("sui", "heal_wound"); - public static final string_id SID_FLY_DRAG = new string_id("base_player", "fly_drag"); - public int OnInitialize(obj_id self) throws InterruptedException - { - return SCRIPT_CONTINUE; - } - public int cmdGenerateCraftedItem(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException - { - if (!isGod(self)) - { - return SCRIPT_CONTINUE; - } - LOG("LOG_CHANNEL", "player_gm.generateCraftedItem commandHandler called. IsGod check passed, and handler is executing."); - debugServerConsoleMsg(self, "************ Entered cmdGenerateCraftedItem."); - java.util.StringTokenizer st = new java.util.StringTokenizer(params); - if (st.countTokens() != 2) - { - sendSystemMessageTestingOnly(self, "Did not find the correct parameters needed to create an item."); - sendSystemMessageTestingOnly(self, "/generateCraftedItem command must at least have schematic template name and attribute percentage paramaters to function."); - sendSystemMessageTestingOnly(self, "Correct usage is /generateCraftedItem "); - debugServerConsoleMsg(self, "************ Did not decode any string tokens from params passed into command handler. Unable to proceed with out at least schematic template name and attribute percentage."); - return SCRIPT_CONTINUE; - } - String template_string = ((st.nextToken())).toLowerCase(); - String schematic = ("object/draft_schematic/" + template_string + ".iff"); - String percentage_string = ((st.nextToken())).toLowerCase(); - int attributePercentage = utils.stringToInt(percentage_string); - if (attributePercentage == -1) - { - LOG("LOG_CHANNEL", "You must specify a valid item attribute percentage."); - sendSystemMessageTestingOnly(self, "You must specify a valid item attribute percentage."); - return SCRIPT_CONTINUE; - } - obj_id creationTarget = null; - if (!isIdValid(target)) - { - creationTarget = getLookAtTarget(self); - if (!isIdValid(creationTarget)) - { - creationTarget = self; - } - } - else - { - creationTarget = target; - } - obj_id inventory = utils.getInventoryContainer(creationTarget); - if (inventory != null) - { - obj_id item = makeCraftedItem(schematic, attributePercentage, inventory); - sendSystemMessageTestingOnly(self, "Item created and placed into the inventory of " + getName(creationTarget)); - CustomerServiceLog("generateCraftedItem", "Object obj_id " + item + " was created of type " + schematic + ". It was created in the inventory of object " + creationTarget + " which is named " + getName(creationTarget) + "."); - debugServerConsoleMsg(self, "Object obj_id " + item + " was created of type " + schematic + ". It was created in the inventory of object " + creationTarget + " which is named " + getName(creationTarget) + "."); - } - return SCRIPT_CONTINUE; - } -} diff --git a/sku.0/sys.shared/compiled/game/datatables/command/command_table.tab b/sku.0/sys.shared/compiled/game/datatables/command/command_table.tab index 91ac386aa..0fd979067 100755 --- a/sku.0/sys.shared/compiled/game/datatables/command/command_table.tab +++ b/sku.0/sys.shared/compiled/game/datatables/command/command_table.tab @@ -698,7 +698,7 @@ gallop immediate gallop 01. Mai 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 gallopStop immediate gallopStop 01. Mai 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 0 0 1 1 optional 3 0 0 gc immediate groupChat 1 1 0 1 1 none 0 0 gcwStatus immediate gcwStatus 0 0 1 1 0 -generateCraftedItem immediate cmdGenerateCraftedItem admin 1 1 0 1 1 1 optional 40 csr 0 +generateCraftedItem immediate cmdGenerateCraftedItem admin 1 1 0 1 1 1 gm.cmd optional 40 csr 0 getAccountInfo immediate failAdmin getAccountInfo admin 1 1 0 1 1 optional 40 csr 0 grantWarden immediate failAdmin grantWarden admin 1 1 0 1 1 optional 40 csr 0 revokeWarden immediate failAdmin revokeWarden admin 1 1 0 1 1 optional 40 csr 0