Files
dsrc/sku.0/sys.server/compiled/game/script/test/qaxp.script
T
2013-09-10 23:17:15 -07:00

370 lines
11 KiB
Plaintext

//**********************************************************
// Copyright (c) ©2005, 2006 Sony Online Entertainment Inc.
// All Rights Reserved
//
// Title: qaxp.script
// Version: Version 2.00
// Description: QA XP Tool
// - allows Tester to give their test character valid NPE and Space XP based upon their test character profession
// - will not allow invalid XP types to be awarded to test characters (example: giveing a trader combat experience)
//
//
// Version Changes: - Added new XP Types to include pilot prestige
//
// @author $Author: Jesse Benjamin
// @version $All Revisions: Jeff Haskell & James Michener
//*********************************************************************
/*
REFERENCE - CURRENT PROFESSIONS
smuggler_1a
bounty_hunter_1a
officer_1a
commando_1a
force_sensitive_1a
medic_1a
spy_1a
entertainer_2a
trader_1a
trader_1b
trader_1c
trader_1d
*/
// ======================================================================
// Library Includes
// ======================================================================
//**********************************************************
// Copyright (c) ©2005, 2006 Sony Online Entertainment Inc.
// All Rights Reserved
//
// Title: qaxp.script
// Version: Version 2.00
// Description: QA XP Tool
// - allows Tester to give their test character valid NPE and Space Prestige based upon their test character profession
// - will not allow invalid XP types to be awarded to test characters (example: giveing a trader combat experience)
//
//
// Version Changes: - Added new XP Types to include pilot prestige
//
// @author $Author: Jesse Benjamin
// @version $All Revisions: Jeff Haskell && James Michener
//***********************************************************
/*
REFERENCE - CURRENT PROFESSIONS
smuggler_1a
bounty_hunter_1a
officer_1a
commando_1a
force_sensitive_1a
medic_1a
spy_1a
entertainer_2a
trader_1a
trader_1b
trader_1c
trader_1d
*/
// ======================================================================
// Library Includes
// ======================================================================
include library.qa;
include library.skill_template;
include library.space_flags;
include library.sui;
include library.utils;
include library.xp;
/***** CONSTANTS *******************************************************/
const int XP_AMOUNT = 1000000;
const string SCRIPTVAR = "qaxp";
const string PROMPT = "Select the amount of XP you desire in the right box";
const string[] QATOOL_MAIN_MENU = dataTableGetStringColumn( "datatables/test/qa_tool_menu.iff", "main_tool" );
const string QATOOL_TITLE = "QA Tools";
const string QATOOL_PROMPT = "Choose the tool you want to use";
const int REVOKE_XP = 0;
const int COMBAT_GENERAL = 1;
const int QUEST_COMBAT = 2;
const int QUEST_CRAFTING = 3;
const int QUEST_SOCIAL = 4;
const int QUEST_GENERAL = 5;
const int PRESTIGE_IMP = 6;
const int PRESTIGE_REB = 7;
const int PRESTIGE_NEUTRAL = 8;
const string[] THIS_TOOL_MENU =
{
"Revoke non-pilot experience",
"combat_general",
"quest_combat",
"quest_crafting",
"quest_social",
"quest_general",
"prestige_imperial",
"prestige_rebel",
"prestige_pilot"
};
const string[] NON_COMBAT_PRFESSIONS =
{
"entertainer",
"trader"
};
/***** TRIGGER *******************************************************/
trigger OnSpeaking(string text)
{
if(isGod(self))
{
if(toLower(text).equals(SCRIPTVAR))
{
//FUNCTION TO SHOW THE MAIN MENU OF THE TOOL
toolMainMenu(self);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
/***** MESSAGEHANDLERS *************************************************/
//THIS HANDLER TAKES CARE OF THE XP TOOL MAIN MENU OPTIONS
messageHandler handleXpOptions()
{
//Find the valid target. Either Self or another Tester
obj_id player = sui.getPlayerId(params);
int btn = sui.getIntButtonPressed(params);
if(btn == sui.BP_CANCEL)
{
removePlayer(player, "");
return SCRIPT_CONTINUE;
}
if(btn == sui.BP_REVERT)
{
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
utils.removeScriptVarTree(player,SCRIPTVAR);
return SCRIPT_CONTINUE;
}
int idx = sui.getListboxSelectedRow(params);
if(idx < 0)
{
removePlayer(player, "");
return SCRIPT_CONTINUE;
}
//GET THE TESTER TEMPLATE
string template = getSkillTemplate(player);
switch (idx)
{
case REVOKE_XP: //Revoke Ground XP
revokeGroungXp(player);
break;
case COMBAT_GENERAL: //combat_general
validateTemplateThenConstructTransferUI(player, THIS_TOOL_MENU[idx], template);
break;
case QUEST_COMBAT: //quest_combat
validateTemplateThenConstructTransferUI(player, THIS_TOOL_MENU[idx], template);
break;
case QUEST_CRAFTING: //quest_crafting
validateTemplateThenConstructTransferUI(player, THIS_TOOL_MENU[idx], template);
break;
case QUEST_SOCIAL: //quest_social
validateTemplateThenConstructTransferUI(player, THIS_TOOL_MENU[idx], template);
break;
case QUEST_GENERAL: //quest_general
validateTemplateThenConstructTransferUI(player, THIS_TOOL_MENU[idx], template);
break;
case PRESTIGE_IMP: //prestige_imperial
validateTemplateThenConstructTransferUI(player, THIS_TOOL_MENU[idx], template);
break;
case PRESTIGE_REB: //prestige_rebel
validateTemplateThenConstructTransferUI(player, THIS_TOOL_MENU[idx], template);
break;
case PRESTIGE_NEUTRAL: //prestige_pilot
validateTemplateThenConstructTransferUI(player, THIS_TOOL_MENU[idx], template);
break;
default:
removePlayer(player, "");
return SCRIPT_CONTINUE;
}
return SCRIPT_CONTINUE;
}
messageHandler handleXpAmountAdd()
{
//Find the valid target. Either Self or another Tester
obj_id player = qa.findTarget(self);
int btn = sui.getIntButtonPressed(params);
int amt = sui.getTransferInputTo(params);
string xpType = utils.getStringScriptVar(player, SCRIPTVAR+".xpType");
if(btn == sui.BP_CANCEL)
{
removePlayer(player, "");
toolMainMenu(player);
return SCRIPT_CONTINUE;
}
xp.grantXpByTemplate(player, amt); // handles finding player template, and flytext
toolMainMenu(player);
return SCRIPT_CONTINUE;
}
messageHandler handleXpAmountRevoke()
{
//Find the valid target. Either Self or another Tester
obj_id player = qa.findTarget(self);
int btn = sui.getIntButtonPressed(params);
int amt = sui.getTransferInputTo(params);
string xpType = utils.getStringScriptVar(player, SCRIPTVAR+".xpType");
if(btn == sui.BP_CANCEL)
{
removePlayer(player, "");
toolMainMenu(player);
return SCRIPT_CONTINUE;
}
xp.grantXpByTemplate(player, -amt); // handles finding player template, and flytext
toolMainMenu(player);
return SCRIPT_CONTINUE;
}
/***** FUNCTIONS *******************************************************/
//BUILDS THE MAIN TOOL MENU
void toolMainMenu(obj_id player)
{
qa.refreshMenu(player, "Select the xp type...", "NPE XP Tool", THIS_TOOL_MENU, "handleXpOptions", "qaxp.pid", SCRIPTVAR+".mainMenu", sui.OK_CANCEL_REFRESH);
}
void removePlayer(obj_id player, string err)
{
sendSystemMessageTestingOnly(player, err);
qa.removeScriptVars(player, SCRIPTVAR);
utils.removeScriptVarTree(player, SCRIPTVAR);
}
void validateTemplateThenConstructTransferUI(obj_id player, string choice, string template)
{
//PILOT PRESTIGE
if(choice.startsWith("prestige"))
{
if(space_flags.hasAnyPilotSkill(player) == true)
{
if(choice.startsWith("prestige"))
{
if (choice == "prestige_imperial" && space_flags.isImperialPilot(player) == true)
{
utils.setScriptVar(player, SCRIPTVAR+".xpType", choice);
sui.transfer(player, player, PROMPT, "XP Tool", "Available", XP_AMOUNT, "Amount", 0, "handleXpAmountAdd");
}
else if (choice == "prestige_rebel" && space_flags.isRebelPilot(player) == true)
{
utils.setScriptVar(player, SCRIPTVAR+".xpType", choice);
sui.transfer(player, player, PROMPT, "XP Tool", "Available", XP_AMOUNT, "Amount", 0, "handleXpAmountAdd");
}
else if (choice == "prestige_pilot" && space_flags.isNeutralPilot(player) == true)
{
utils.setScriptVar(player, SCRIPTVAR+".xpType", choice);
sui.transfer(player, player, PROMPT, "XP Tool", "Available", XP_AMOUNT, "Amount", 0, "handleXpAmountAdd");
}
else
{
sendSystemMessageTestingOnly(player, "The player has to be the correct Pilot Faction in order to receive this prestige.");
}
}
else
{
utils.setScriptVar(player, SCRIPTVAR+".xpType", choice);
sui.transfer(player, player, PROMPT, "XP Tool", "Available", XP_AMOUNT, "Amount", 0, "handleXpAmountAdd");
}
}
else
{
//THE PLAYER IS NOT A PILOT - ERROR MSG
removePlayer(player, "The test character does not have a pilot skill");
toolMainMenu(player);
}
}
//ALL OTHER XP TYPES
else
{
string templateType = "";
for(int i = 0; i < NON_COMBAT_PRFESSIONS.length; i++)
{
if(template.startsWith(NON_COMBAT_PRFESSIONS[i]))
{
templateType = "noncombat";
}
}
//Combat Professions are handled here
if(templateType == "")
{
if(choice == "combat_general" || choice == "quest_combat" || choice == "quest_general")
{
utils.setScriptVar(player, SCRIPTVAR+".xpType", choice);
sui.transfer(player, player, PROMPT, "XP Tool", "Available", XP_AMOUNT, "Amount", 0, "handleXpAmountAdd");
}
else
{
removePlayer(player, "The player needs to have the correct profession to seek a non-Combat XP type. (You are a Combat Profession) ");
toolMainMenu(player);
}
}
//Non-Combat Profession are handled here
else
{
if(choice == "quest_social" && template.startsWith("entertainer") || choice == "quest_general" && template.startsWith("entertainer"))
{
templateType = "";
utils.setScriptVar(player, SCRIPTVAR+".xpType", choice);
sui.transfer(player, player, PROMPT, "XP Tool", "Available", XP_AMOUNT, "Amount", 0, "handleXpAmountAdd");
}
else if(choice == "quest_crafting" && template.startsWith("trader") || choice == "quest_general" && template.startsWith("trader"))
{
templateType = "";
utils.setScriptVar(player, SCRIPTVAR+".xpType", choice);
sui.transfer(player, player, PROMPT, "XP Tool", "Available", XP_AMOUNT, "Amount", 0, "handleXpAmountAdd");
}
else
{
removePlayer(player, "The player needs to have the correct profession to seek that XP type.");
toolMainMenu(player);
}
}
}
}
//Revoke XP
void revokeGroungXp(obj_id player)
{
string skillName = getWorkingSkill(player);
string xpType = skill_template.getSkillExperienceType(skillName);
utils.setScriptVar(player, SCRIPTVAR+".xpType", xpType);
sui.transfer(player, player, PROMPT, "XP Tool", "Revoke Experience", XP_AMOUNT, "Amount", 0, "handleXpAmountRevoke");
}