mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-01-17 00:05:07 -05:00
Move generateCraftedItem to gm.cmd
This commit is contained in:
@@ -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 <schematic name> <quality-percentage(integer)>");
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 <schematic name> <quality-percentage(integer)>");
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user