mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
Refactors factional presence tracking from src to dsrc for more flexibility and hooking to GCW leaderboard for scaled scoring later Addresses a number of faction base and faction presence GU items Rescripted gmRevive to have more functionality Restore Planet Map Cats to final day
220 lines
7.4 KiB
Java
Executable File
220 lines
7.4 KiB
Java
Executable File
package script.library;
|
|
|
|
import script.location;
|
|
import script.obj_id;
|
|
|
|
public class space_skill extends script.base_script
|
|
{
|
|
public space_skill()
|
|
{
|
|
}
|
|
public static final String WAYPOINT_BTN = "@space/space_interaction:retire_waypoint_btn";
|
|
public static final String REBEL_WARNING = "@space/space_interaction:retire_rebel_warning";
|
|
public static final String IMPERIAL_WARNING = "@space/space_interaction:retire_imperial_warning";
|
|
public static final String NEUTRAL_WARNING = "@space/space_interaction:retire_neutral_warning";
|
|
public static final String WARNING_TITLE = "@space/space_interaction:retire_warning_title";
|
|
public static final String REBEL_WP_NAME = "@npc_spawner_n:j_pai_brek";
|
|
public static final String IMPERIAL_WP_NAME = "@npc_spawner_n:landau";
|
|
public static final String NEUTRAL_WP_NAME = "@npc_spawner_n:gil_burtin";
|
|
public static final String REBEL = "pilot_rebel_navy";
|
|
public static final String IMPERIAL = "pilot_imperial_navy";
|
|
public static final String NEUTRAL = "pilot_neutral";
|
|
public static final 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"
|
|
};
|
|
public static boolean hasRebelSkill(obj_id player) throws InterruptedException
|
|
{
|
|
return (hasSkill(player, "pilot_rebel_navy_novice"));
|
|
}
|
|
public static boolean hasImperialSkill(obj_id player) throws InterruptedException
|
|
{
|
|
return (hasSkill(player, "pilot_imperial_navy_novice"));
|
|
}
|
|
public static boolean hasPilotSkill(obj_id player) throws InterruptedException
|
|
{
|
|
return (hasSkill(player, "pilot_neutral_novice"));
|
|
}
|
|
public static boolean hasSpaceSkills(obj_id player) throws InterruptedException
|
|
{
|
|
if (hasRebelSkill(player))
|
|
{
|
|
return true;
|
|
}
|
|
else if (hasImperialSkill(player))
|
|
{
|
|
return true;
|
|
}
|
|
else if (hasPilotSkill(player))
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
public static void retire(obj_id player, String profession) throws InterruptedException
|
|
{
|
|
utils.setScriptVar(player, "revokePilotSkill", 1);
|
|
for (String skillName : SKILL_NAMES) {
|
|
String skill = profession + skillName;
|
|
if (hasSkill(player, skill)) {
|
|
revokeSkill(player, skill);
|
|
}
|
|
}
|
|
utils.removeScriptVar(player, "revokePilotSkill");
|
|
}
|
|
public static void retireWarning(obj_id player, String skill) throws InterruptedException
|
|
{
|
|
String prompt = "";
|
|
String wp_name = "";
|
|
location loc = new location();
|
|
if (skill.contains("rebel"))
|
|
{
|
|
prompt = REBEL_WARNING;
|
|
wp_name = REBEL_WP_NAME;
|
|
loc = new location(-5072.0f, 0.0f, -2343.0f, "corellia");
|
|
}
|
|
else if (skill.contains("imperial"))
|
|
{
|
|
prompt = IMPERIAL_WARNING;
|
|
wp_name = IMPERIAL_WP_NAME;
|
|
loc = new location(-5516.0f, 0.0f, 4403.0f, "naboo");
|
|
}
|
|
else if (skill.contains("neutral"))
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
public static void revokeExperienceForRetire(obj_id player, String skill) throws InterruptedException
|
|
{
|
|
String prestigeXpName = "";
|
|
if (skill.contains("rebel"))
|
|
{
|
|
prestigeXpName = xp.SPACE_PRESTIGE_REBEL;
|
|
}
|
|
else if (skill.contains("imperial"))
|
|
{
|
|
prestigeXpName = xp.SPACE_PRESTIGE_IMPERIAL;
|
|
}
|
|
else if (skill.contains("neutral"))
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
public static boolean isMasterPilot(obj_id player) throws InterruptedException
|
|
{
|
|
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;
|
|
}
|
|
public static boolean hasTier3Skills(obj_id player) throws InterruptedException {
|
|
if (hasRebelSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_rebel_navy_droid_03"));
|
|
}
|
|
if (hasImperialSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_imperial_navy_droid_03"));
|
|
}
|
|
if (hasPilotSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_neutral_droid_03"));
|
|
}
|
|
return false;
|
|
}
|
|
public static boolean hasTier2Skills(obj_id player) throws InterruptedException {
|
|
if (hasRebelSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_rebel_navy_droid_02"));
|
|
}
|
|
if (hasImperialSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_imperial_navy_droid_02"));
|
|
}
|
|
if (hasPilotSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_neutral_droid_02"));
|
|
}
|
|
return false;
|
|
}
|
|
public static boolean hasTier1Skills(obj_id player) throws InterruptedException {
|
|
if (hasRebelSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_rebel_navy_droid_01"));
|
|
}
|
|
if (hasImperialSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_imperial_navy_droid_01"));
|
|
}
|
|
if (hasPilotSkill(player))
|
|
{
|
|
return (hasSkill(player, "pilot_neutral_droid_01"));
|
|
}
|
|
return false;
|
|
}
|
|
|
|
}
|