mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-28 22:15:54 -04:00
142 lines
4.6 KiB
Plaintext
142 lines
4.6 KiB
Plaintext
//**********************************************************
|
|
// Copyright (c) ©2000,2001 Sony Online Entertainment Inc.
|
|
// All Rights Reserved
|
|
//
|
|
// Title: qainventory.script
|
|
// Description: Inventory functions
|
|
// @author $Author: Jesse Benjamin $
|
|
// @version $Revision: #1 $
|
|
//***********************************************************
|
|
|
|
/********* Includes ******************************************/
|
|
include library.qa;
|
|
include library.sui;
|
|
include library.utils;
|
|
|
|
/********* CONSTANTS *****************************************/
|
|
const string PROMPT = "Choose an Option";
|
|
const string TITLE = "QA Inventory Tool";
|
|
const string[] MAIN_MENU =
|
|
{
|
|
"Delete all in inventory",
|
|
"Fill inventory with Junk"
|
|
};
|
|
const string SCRIPT_VAR = "qainv";
|
|
const string FROG_STRING = "object/tangible/terminal/terminal_character_builder.iff"; // frog template name
|
|
const string KASHYYYK_FROG_STRING = "object/tangible/terminal/terminal_kashyyyk_content.iff"; // kashyyyk content tool name
|
|
|
|
/********* Triggers ******************************************/
|
|
trigger OnAttach()
|
|
{
|
|
if (isGod(self))
|
|
{
|
|
if(getGodLevel(self) < 10)
|
|
{
|
|
detachScript(self, "test.qainventory");
|
|
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
|
|
}
|
|
}
|
|
else if (!isGod(self))
|
|
{
|
|
detachScript(self, "test.qainventory");
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnSpeaking(string text)
|
|
{
|
|
obj_id player = self;
|
|
if(isGod(player))
|
|
{
|
|
if (toLower(text).equals("qainventory") )
|
|
{
|
|
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", true, SCRIPT_VAR+".pid");
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
/********* Command Handlers **********************************/
|
|
|
|
messageHandler mainMenuOptions()
|
|
{
|
|
if (isGod(self))
|
|
{
|
|
if (utils.hasScriptVar(self, SCRIPT_VAR+".pid"))
|
|
{
|
|
qa.checkParams(params, SCRIPT_VAR, false);
|
|
obj_id player = sui.getPlayerId(params);
|
|
int idx = sui.getListboxSelectedRow(params);
|
|
int btn = sui.getIntButtonPressed(params);
|
|
obj_id inventory = utils.getInventoryContainer(player);
|
|
|
|
if (btn == sui.BP_CANCEL)
|
|
{
|
|
qa.removeScriptVars(player,SCRIPT_VAR);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if (btn == sui.BP_REVERT)
|
|
{
|
|
//Go back to tool Mainmenu
|
|
string[] options = utils.getStringArrayScriptVar(player, "qatool.toolMainMenu");
|
|
string mainTitle = utils.getStringScriptVar(player, "qatool.title");
|
|
string mainPrompt = utils.getStringScriptVar(player, "qatool.prompt");
|
|
if (options == null)
|
|
{
|
|
sendSystemMessageTestingOnly(player, "You didn't start from the main tool menu");
|
|
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", true, SCRIPT_VAR+".pid");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
qa.refreshMenu( self, mainPrompt, mainTitle, options, "toolMainMenu", true, "qatool.pid");
|
|
utils.removeScriptVarTree(player,SCRIPT_VAR);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
switch (idx)
|
|
{
|
|
case 0: //delete all from inventory except the Frog and Kashyyk Content Tool
|
|
//get array of items in player's inventory
|
|
obj_id[] items = getContents(inventory);
|
|
for (int i = 0; i < items.length; i++)
|
|
{
|
|
// get template names of items in player's inventory
|
|
string templateName = getTemplateName(items[i]);
|
|
// if -- frog or kashyyyk frog do not delete
|
|
if (templateName == FROG_STRING)
|
|
{
|
|
sendSystemMessageTestingOnly(player, "The Frog will not be destroyed");
|
|
}
|
|
else if (templateName == KASHYYYK_FROG_STRING)
|
|
{
|
|
sendSystemMessageTestingOnly(player, "The Kashyyyk Frog will not be destroyed");
|
|
|
|
}
|
|
// delete everything else
|
|
else
|
|
{
|
|
destroyObject(items[i]);
|
|
}
|
|
}
|
|
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has deleted the entire contents of their inventory (less any Character Builder Terminals) using the QA Inventory Tool.");
|
|
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", SCRIPT_VAR+".pid", sui.OK_CANCEL_REFRESH);
|
|
break;
|
|
case 1: //Fill inventory
|
|
int freeSpace = getVolumeFree(inventory);
|
|
for (int i = 0; i < freeSpace; i++)
|
|
createObject("object/tangible/food/fruit_melon.iff", inventory, "");
|
|
|
|
CustomerServiceLog("qaTool","User: (" + self + ") " + getName(self) + " has filled the entire contents of their inventory using the QA Inventory Tool.");
|
|
qa.refreshMenu(player, PROMPT, TITLE, MAIN_MENU, "mainMenuOptions", SCRIPT_VAR+".pid", sui.OK_CANCEL_REFRESH);
|
|
break;
|
|
default:
|
|
qa.removeScriptVars(player,SCRIPT_VAR);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
} |