mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
187 lines
4.3 KiB
Plaintext
187 lines
4.3 KiB
Plaintext
include library.sui;
|
|
include library.utils;
|
|
include library.xp;
|
|
|
|
const string WAYPOINT_BTN = "@space/space_interaction:retire_waypoint_btn";
|
|
|
|
const string REBEL_WARNING = "@space/space_interaction:retire_rebel_warning";
|
|
const string IMPERIAL_WARNING = "@space/space_interaction:retire_imperial_warning";
|
|
const string NEUTRAL_WARNING = "@space/space_interaction:retire_neutral_warning";
|
|
const string WARNING_TITLE = "@space/space_interaction:retire_warning_title";
|
|
|
|
const string REBEL_WP_NAME = "@npc_spawner_n:j_pai_brek";
|
|
const string IMPERIAL_WP_NAME = "@npc_spawner_n:landau";
|
|
const string NEUTRAL_WP_NAME = "@npc_spawner_n:gil_burtin";
|
|
|
|
const string REBEL = "pilot_rebel_navy";
|
|
const string IMPERIAL = "pilot_imperial_navy";
|
|
const string NEUTRAL = "pilot_neutral";
|
|
|
|
const string[] SKILL_NAMES = {
|
|
"_master",
|
|
"_starships_04",
|
|
"_weapons_04",
|
|
"_procedures_04",
|
|
"_droid_04",
|
|
"_starships_03",
|
|
"_weapons_03",
|
|
"_procedures_03",
|
|
"_droid_03",
|
|
"_starships_02",
|
|
"_weapons_02",
|
|
"_procedures_02",
|
|
"_droid_02",
|
|
"_starships_01",
|
|
"_weapons_01",
|
|
"_procedures_01",
|
|
"_droid_01",
|
|
"_novice"
|
|
};
|
|
|
|
|
|
boolean hasRebelSkill( obj_id player )
|
|
{
|
|
return ( hasSkill( player, "pilot_rebel_navy_novice") );
|
|
}
|
|
|
|
boolean hasImperialSkill( obj_id player )
|
|
{
|
|
return ( hasSkill( player, "pilot_imperial_navy_novice") );
|
|
}
|
|
|
|
boolean hasPilotSkill( obj_id player )
|
|
{
|
|
return ( hasSkill( player, "pilot_neutral_novice") );
|
|
}
|
|
|
|
boolean hasSpaceSkills( obj_id player )
|
|
{
|
|
if ( hasRebelSkill(player) )
|
|
return true;
|
|
else if ( hasImperialSkill( player ) )
|
|
return true;
|
|
else if ( hasPilotSkill(player) )
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
void retire(obj_id player, string profession) {
|
|
|
|
utils.setScriptVar(player, "revokePilotSkill", 1);
|
|
|
|
for(int i = 0; i < SKILL_NAMES.length; i++) {
|
|
|
|
string skill = profession + SKILL_NAMES[i];
|
|
|
|
if(hasSkill(player, skill))
|
|
revokeSkill(player, skill);
|
|
}
|
|
|
|
utils.removeScriptVar(player, "revokePilotSkill");
|
|
}
|
|
|
|
void retireWarning(obj_id player, string skill) {
|
|
|
|
string prompt = "";
|
|
string wp_name = "";
|
|
location loc = new location();
|
|
|
|
if(skill.indexOf("rebel") >= 0) {
|
|
|
|
prompt = REBEL_WARNING;
|
|
wp_name = REBEL_WP_NAME;
|
|
loc = new location(-5072.0f, 0.0f, -2343.0f, "corellia");
|
|
|
|
} else if(skill.indexOf("imperial") >= 0) {
|
|
|
|
prompt = IMPERIAL_WARNING;
|
|
wp_name = IMPERIAL_WP_NAME;
|
|
loc = new location(-5516.0f, 0.0f, 4403.0f, "naboo");
|
|
|
|
} else if(skill.indexOf("neutral") >= 0) {
|
|
|
|
prompt = NEUTRAL_WARNING;
|
|
wp_name = NEUTRAL_WP_NAME;
|
|
loc = new location(-1174.0f, 0.0f, -3647.0f, "tatooine");
|
|
|
|
} else {
|
|
|
|
return;
|
|
}
|
|
|
|
int pid = createSUIPage(sui.SUI_MSGBOX, player, player, "handleRetireWarning");
|
|
|
|
setSUIProperty(pid, sui.MSGBOX_PROMPT, sui.PROP_TEXT, prompt);
|
|
setSUIProperty(pid, sui.MSGBOX_TITLE, sui.PROP_TEXT, WARNING_TITLE);
|
|
|
|
sui.msgboxHideBtnLeft(pid);
|
|
setSUIProperty(pid, sui.MSGBOX_BTN_CANCEL, sui.PROP_TEXT, WAYPOINT_BTN);
|
|
setSUIProperty(pid, sui.MSGBOX_BTN_OK, sui.PROP_TEXT, "@ok");
|
|
|
|
showSUIPage(pid);
|
|
|
|
if(pid > 0) {
|
|
|
|
utils.setScriptVar(player, "revokePilotSkillWarningLoc", loc);
|
|
utils.setScriptVar(player, "revokePilotSkillWarningWpName", wp_name);
|
|
}
|
|
}
|
|
|
|
void revokeExperienceForRetire(obj_id player, string skill) {
|
|
|
|
string prestigeXpName = "";
|
|
|
|
if(skill.indexOf("rebel") >= 0) {
|
|
|
|
prestigeXpName = xp.SPACE_PRESTIGE_REBEL;
|
|
|
|
} else if(skill.indexOf("imperial") >= 0) {
|
|
|
|
prestigeXpName = xp.SPACE_PRESTIGE_IMPERIAL;
|
|
|
|
} else if(skill.indexOf("neutral") >= 0) {
|
|
|
|
prestigeXpName = xp.SPACE_PRESTIGE_PILOT;
|
|
|
|
} else {
|
|
|
|
return;
|
|
}
|
|
|
|
int prestigeXp = getExperiencePoints(player, prestigeXpName);
|
|
|
|
if(prestigeXp > 0) {
|
|
|
|
prestigeXp *= -1;
|
|
xp.grantUnmodifiedExperience(player, prestigeXpName, prestigeXp);
|
|
}
|
|
|
|
int combatXp = getExperiencePoints(player, xp.SPACE_COMBAT_GENERAL);
|
|
|
|
if(combatXp > 0) {
|
|
|
|
combatXp *= -1;
|
|
xp.grantUnmodifiedExperience(player, xp.SPACE_COMBAT_GENERAL, combatXp);
|
|
}
|
|
}
|
|
|
|
boolean isMasterPilot(obj_id player)
|
|
{
|
|
if(hasRebelSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_rebel_navy_master"));
|
|
}
|
|
|
|
if(hasImperialSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_imperial_navy_master"));
|
|
}
|
|
|
|
if(hasPilotSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_neutral_master"));
|
|
}
|
|
|
|
return false;
|
|
} |