mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-01-17 00:05:07 -05:00
* Code compiles - execution NOT tested * updating gitignore * Removed intellij settings files * Removed more intellij files * Added exclusion for JDK classes. * Fixed purchasing script for vendors that have listed coin types. * Updated script to not kick off until the entire preload is complete. * adds static name entry for Solo movie poster and tcg9 vendor entry * clean up empty and orphaned object templates * adds placeholder black market (static) spawns * corrects entries for the video game table to correctly set it in tcg series 2 and remove series 1 console errors * Updated gitignore and removed intellij project files * Fixed appearance reference for thranta payroll and kashyyyk door, added skipLosCheck objvar due to cannit see issue. Requires updated src * Fixed appearance and template for terminal (#2) * Fixed appearance and template for terminal (#3) * Fixed appearance and template for terminal (#4) * Deleted another faulty/orphaned object template * Fixed gcw ranks option on frog. Only issue is that it doesn't award the officer commands or badges. * Fixed some unneeded java 11 changes
209 lines
7.9 KiB
Java
Executable File
209 lines
7.9 KiB
Java
Executable File
package script.library;
|
|
|
|
import script.dictionary;
|
|
import script.obj_id;
|
|
import script.string_id;
|
|
|
|
public class missions extends script.base_script
|
|
{
|
|
public missions()
|
|
{
|
|
}
|
|
public static final int STATE_DYNAMIC_PICKUP = 1;
|
|
public static final int STATE_DYNAMIC_DROPOFF = 2;
|
|
public static final int STATE_DYNAMIC_START = 3;
|
|
public static final int STATE_DELIVER_PICKUP = 4;
|
|
public static final int STATE_DELIVER_DROPOFF = 5;
|
|
public static final int STATE_DEAD = 6;
|
|
public static final int STATE_MISSION_COMPLETE = 7;
|
|
public static final int BH_STAT_MIN = -1;
|
|
public static final int WINS = 0;
|
|
public static final int LOSSES = 1;
|
|
public static final int ABORTS = 2;
|
|
public static final int TIMEOUTS = 3;
|
|
public static final int BH_STAT_MAX = 4;
|
|
public static final int BOUNTY_FLAG_NONE = 0;
|
|
public static final int BOUNTY_FLAG_SMUGGLER = 1;
|
|
public static final int DAILY_MISSION_XP_REWARD_DEFAULT = 10;
|
|
public static final int DAILY_MISSION_CASH_REWARD = 15;
|
|
public static final int DAILY_MISSION_XP_SANITY = 5;
|
|
public static final int DAILY_MISSION_XP_LOW = 9;
|
|
public static final int DAILY_MISSION_XP_MEDIUM = 14;
|
|
public static final int DAILY_MISSION_XP_HIGH = 19;
|
|
public static final String DAILY_MISSION_OBJVAR = "missions.daily";
|
|
public static final String DAILY_MISSION_CLOCK_OBJVAR = "missions.dailyClock";
|
|
public static final string_id DAILY_REWARD_XP = new string_id("base_player", "prose_mission_xp_amount");
|
|
public static int getDailyMissionXpLimit() throws InterruptedException
|
|
{
|
|
String config = getConfigSetting("Custom", "dailyMissionXpLimit");
|
|
if (config != null && config.length() > 0) {
|
|
return utils.stringToInt(config);
|
|
}
|
|
return DAILY_MISSION_XP_REWARD_DEFAULT;
|
|
}
|
|
public static void sendBountyFail(obj_id hunter, obj_id target) throws InterruptedException
|
|
{
|
|
dictionary params = new dictionary();
|
|
params.put("target", target);
|
|
setObjVar(hunter, "intState", STATE_MISSION_COMPLETE);
|
|
messageTo(hunter, "bountyFailure", params, 0, true);
|
|
}
|
|
public static void sendBountySuccess(obj_id hunter, obj_id target) throws InterruptedException
|
|
{
|
|
dictionary params = new dictionary();
|
|
params.put("target", target);
|
|
setObjVar(hunter, "intState", STATE_MISSION_COMPLETE);
|
|
messageTo(hunter, "bountySuccess", params, 0, true);
|
|
}
|
|
public static void sendBountyIncomplete(obj_id hunter, obj_id target) throws InterruptedException
|
|
{
|
|
dictionary params = new dictionary();
|
|
params.put("target", target);
|
|
setObjVar(hunter, "intState", STATE_MISSION_COMPLETE);
|
|
messageTo(hunter, "bountyIncomplete", params, 0, true);
|
|
}
|
|
public static void increaseBountyJediKillTracking(obj_id objPlayer, int stat) throws InterruptedException
|
|
{
|
|
if (stat <= missions.BH_STAT_MIN || stat >= missions.BH_STAT_MAX)
|
|
{
|
|
return;
|
|
}
|
|
int[] killData = new int[missions.BH_STAT_MAX];
|
|
if (!hasObjVar(objPlayer, "bounty_hunter.jedi_kill_tracker"))
|
|
{
|
|
setObjVar(objPlayer, "bounty_hunter.jedi_kill_tracker", killData);
|
|
}
|
|
killData = getIntArrayObjVar(objPlayer, "bounty_hunter.jedi_kill_tracker");
|
|
if (killData.length != missions.BH_STAT_MAX)
|
|
{
|
|
return;
|
|
}
|
|
killData[stat]++;
|
|
setObjVar(objPlayer, "bounty_hunter.jedi_kill_tracker", killData);
|
|
}
|
|
public static int getPlayerDailyCount(obj_id player) throws InterruptedException
|
|
{
|
|
if (!isIdValid(player))
|
|
{
|
|
return 0;
|
|
}
|
|
if (!hasObjVar(player, DAILY_MISSION_OBJVAR))
|
|
{
|
|
return 0;
|
|
}
|
|
return getIntObjVar(player, DAILY_MISSION_OBJVAR);
|
|
}
|
|
public static void incrementDaily(obj_id player) throws InterruptedException
|
|
{
|
|
int missionData = getPlayerDailyCount(player);
|
|
if (!hasObjVar(player, DAILY_MISSION_CLOCK_OBJVAR))
|
|
{
|
|
int currentTime = getCalendarTime();
|
|
int alarmTime = createDailyAlarmClock(player, "handleDailyMissionReset", null, 19, 0, 0);
|
|
int alarmTimeObjVar = currentTime + alarmTime;
|
|
setObjVar(player, DAILY_MISSION_CLOCK_OBJVAR, alarmTimeObjVar);
|
|
}
|
|
missionData++;
|
|
setObjVar(player, DAILY_MISSION_OBJVAR, missionData);
|
|
}
|
|
public static boolean canEarnDailyMissionXp(obj_id player) throws InterruptedException
|
|
{
|
|
if (!isIdValid(player))
|
|
{
|
|
return false;
|
|
}
|
|
int dailyData = getPlayerDailyCount(player);
|
|
if (dailyData < 0)
|
|
{
|
|
return false;
|
|
}
|
|
if (utils.isProfession(player, utils.TRADER) || utils.isProfession(player, utils.ENTERTAINER))
|
|
{
|
|
return false;
|
|
}
|
|
if (dailyData < getDailyMissionXpLimit())
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public static float alterMissionPayoutDivisor(obj_id player, float divisor, int missionLevel) throws InterruptedException
|
|
{
|
|
int playerLevel = getLevel(player);
|
|
int levelDelta = Math.abs(missionLevel - playerLevel);
|
|
divisor = alterMissionPayoutDivisorDaily(player, divisor);
|
|
if (utils.isProfession(player, utils.ENTERTAINER))
|
|
{
|
|
divisor += 10.0f;
|
|
}
|
|
if (utils.isProfession(player, utils.TRADER))
|
|
{
|
|
divisor += 20.0f;
|
|
}
|
|
if (levelDelta >= 10)
|
|
{
|
|
divisor += (float)levelDelta / 2;
|
|
}
|
|
return divisor;
|
|
}
|
|
public static float alterMissionPayoutDivisorDaily(obj_id player, float divisor) throws InterruptedException
|
|
{
|
|
int missionsCompleted = getPlayerDailyCount(player);
|
|
if (missionsCompleted > DAILY_MISSION_CASH_REWARD)
|
|
{
|
|
divisor += missionsCompleted;
|
|
}
|
|
return divisor;
|
|
}
|
|
public static float alterMissionPayoutDivisorDaily(obj_id player) throws InterruptedException
|
|
{
|
|
return alterMissionPayoutDivisorDaily(player, 1.0f);
|
|
}
|
|
public static void initializeDailyOnLogin(obj_id player) throws InterruptedException
|
|
{
|
|
if (hasObjVar(player, DAILY_MISSION_CLOCK_OBJVAR))
|
|
{
|
|
int currentTime = getCalendarTime();
|
|
int alarmTimeObjVar = getIntObjVar(player, missions.DAILY_MISSION_CLOCK_OBJVAR);
|
|
if (currentTime >= alarmTimeObjVar)
|
|
{
|
|
clearDailyObjVars(player);
|
|
}
|
|
else
|
|
{
|
|
int secondsUntil = alarmTimeObjVar - currentTime;
|
|
messageTo(player, "handleDailyMissionReset", null, secondsUntil, false);
|
|
}
|
|
}
|
|
else if (hasObjVar(player, DAILY_MISSION_OBJVAR))
|
|
{
|
|
int countObjVar = getIntObjVar(player, missions.DAILY_MISSION_OBJVAR);
|
|
if (countObjVar > 0)
|
|
{
|
|
int currentTime = getCalendarTime();
|
|
int alarmTime = createDailyAlarmClock(player, "handleDailyMissionReset", null, 19, 0, 0);
|
|
int alarmTimeObjVar = currentTime + alarmTime;
|
|
setObjVar(player, DAILY_MISSION_CLOCK_OBJVAR, alarmTimeObjVar);
|
|
}
|
|
}
|
|
}
|
|
public static void clearDailyObjVars(obj_id player) throws InterruptedException
|
|
{
|
|
setObjVar(player, DAILY_MISSION_OBJVAR, 0);
|
|
removeObjVar(player, DAILY_MISSION_CLOCK_OBJVAR);
|
|
}
|
|
public static boolean isDestroyMission(obj_id objMissionData) throws InterruptedException
|
|
{
|
|
if (!isIdValid(objMissionData))
|
|
{
|
|
return false;
|
|
}
|
|
String strTest = getMissionType(objMissionData);
|
|
if (strTest.equals("destroy"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|