mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
114 lines
3.8 KiB
Plaintext
114 lines
3.8 KiB
Plaintext
/**
|
|
* Copyright (c)2000-2002 Sony Online Entertainment Inc.
|
|
* All Rights Reserved
|
|
*
|
|
* Title: healing.script
|
|
* Description: Player script for the healing system.
|
|
* @author $Author: bhanson $
|
|
* @version $Revision:$
|
|
*/
|
|
|
|
|
|
/***** INCLUDES ********************************************************/
|
|
|
|
include library.healing;
|
|
include library.dot;
|
|
include library.utils;
|
|
include library.consumable;
|
|
include library.pet_lib;
|
|
include library.group;
|
|
include library.pclib;
|
|
include library.combat;
|
|
include library.colors;
|
|
include library.sui;
|
|
|
|
/***** CONSTANTS *******************************************************/
|
|
|
|
const string_id SID_HEAL_DAMAGE = new string_id("sui", "heal_damage");
|
|
const string_id SID_HEAL_WOUND = new string_id("sui", "heal_wound");
|
|
|
|
const string_id SID_FLY_DRAG = new string_id("base_player","fly_drag");
|
|
|
|
/***** TRIGGERS ********************************************************/
|
|
|
|
trigger OnInitialize()
|
|
{
|
|
//LOG("LOG_CHANNEL", "player_healing.OnAttach called.");
|
|
|
|
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** MESSAGEHANDLERS *************************************************/
|
|
|
|
/***** COMMANDHANDLERS *************************************************/
|
|
|
|
commandHandler cmdGenerateCraftedItem()
|
|
{
|
|
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;
|
|
}
|
|
|
|
|
|
// Convert the first token string into the schematic template
|
|
string template_string = (st.nextToken()).toLowerCase();
|
|
string schematic = ("object/draft_schematic/" + template_string + ".iff");
|
|
|
|
|
|
// Convert the next token string into the attribute percentage
|
|
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;
|
|
}
|
|
|
|
|
|
//figure out the created-items initial location
|
|
obj_id creationTarget = null;
|
|
if ( !isIdValid(target) )
|
|
{
|
|
creationTarget = getLookAtTarget(self);
|
|
if ( !isIdValid(creationTarget) )
|
|
{
|
|
creationTarget = self;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
creationTarget = target;
|
|
}
|
|
obj_id inventory = utils.getInventoryContainer(creationTarget);
|
|
|
|
|
|
//verify target inventory isn't null, then create object
|
|
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;
|
|
}
|
|
|