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

1888 lines
75 KiB
Plaintext

/**********************************************************************
* Copyright (c)2000-2004 Sony Online Entertainment Inc.
* All Rights Reserved
*
* Title: holiday
* Description: Handles constants, etc. for holiday events
**********************************************************************/
/***** INCLUDES ********************************************************/
include library.badge;
include library.gcw;
include library.groundquests;
include library.utils;
/***** CONSTANTS *******************************************************/
//PLANET WIDE CONSTANTS
const string PLANET_VAR_EVENT_PREFIX = "event";
const string PLANET_VAR_SCORE = ".score";
const string PLANET_VAR_EMPIRE_DAY = ".empire_day";
const string PLANET_VAR_SCORE_TIMESTAMP = PLANET_VAR_SCORE + ".timestamp";
const string PLANET_VAR_PLAYER_NAME = ".player_name";
const string PLANET_VAR_PLAYER_SCORE = ".player_score";
const string PLANET_VAR_PLAYER_FACTION_IMP = ".imperial";
const string PLANET_VAR_PLAYER_FACTION_REB = ".rebel";
//EMPIRE DAY CONSTANTS
const string EMPIRE_DAY_RECEIVED_VI = "gift.empire08";
const string EMPIRE_DAY_RECEIVED_VII = "gift.empire09";
const string EMPIRE_DAY_CHAMPION_BADGE = "empire_day_champion_badge_2009";
const string REMEMBRANCE_DAY_CHAMPION_BADGE = "remembrance_day_champion_badge_2009";
const string SPAWNER_PREFIX_OBJVAR = "spawned.";
const string LEADER_BOARD_TITLE = "Leader Boards Empire & Remembrance Day";
const string LEADERSUI_PID_NAME = "leaderBoardPid";
const string PLAYER_EMPIRE_DAY_PREFIX = PLANET_VAR_EVENT_PREFIX + PLANET_VAR_EMPIRE_DAY;
const string PLAYER_EMPIRE_DAY_SCORE = PLAYER_EMPIRE_DAY_PREFIX + PLANET_VAR_SCORE;
const string PLAYER_EMPIRE_DAY_NEUTRAL = PLAYER_EMPIRE_DAY_PREFIX + ".neutral";
//update these every year
const string IMPERIAL_AND_REBEL_EVENT_GIFT = "item_empire_day_6yr_painting";
const string IMPERIAL_EMPIRE_DAY_GIFT = "item_empire_day_6yr_greeter_tie_pilot";
const string REBEL_REMEMBRANCE_DAY_GIFT = "item_empire_day_6yr_greeter_xwing_pilot";
//datatables
const string EMOTE_DATATABLE = "datatables/npc/emperors_day/badge_emotes.iff";
const string LIFEDAY = "event/life_day";
const string EMP_DAY = "event/emperors_day";
const string EMPIRE_DAY = "event/empire_day";
const string_id GIFT_GRANTED = new string_id(EMP_DAY, "gift_granted_empire");
const string_id GIFT_GRANTED_REBEL = new string_id(EMP_DAY, "gift_granted_rebel");
//GOD SYS MESSAGES
const string_id SID_REM_EMP_DAY_BADGE = new string_id(EMP_DAY, "empire_day_badge_removed");
const string_id SID_REM_REM_DAY_BADGE = new string_id(EMP_DAY, "remembrance_day_badge_removed");
const string_id SID_REMOVED_REWARD_FLAG = new string_id(EMP_DAY, "reward_flag_removed");
const string_id SID_MOUNTED = new string_id(LIFEDAY, "mounted");
const string_id SID_REACHED_LIMIT = new string_id(LIFEDAY, "reached_limit");
const string_id SID_COMPLETED_QUOTA = new string_id(EMPIRE_DAY, "completed_collection");
const string_id SID_IMPERIAL_COMPETITIVE_START = new string_id(EMPIRE_DAY, "imperial_competitive_start");
const string_id SID_REBEL_COMPETITIVE_START = new string_id(EMPIRE_DAY, "rebel_competitive_start");
const string_id SID_LOCKED_OUT = new string_id(LIFEDAY, "locked_out");
const string_id SID_IMPERIAL_START = new string_id(EMPIRE_DAY, "imperial_start");
const string_id SID_REBEL_START = new string_id(EMPIRE_DAY, "rebel_start");
const string_id SID_GCW_POINTS = new string_id(EMPIRE_DAY, "you_received_gcw_points");
const string_id SID_CONGRATS_QUOTA_IMPERIAL = new string_id(EMPIRE_DAY, "congratz_quota_accomplished_imp");
const string_id SID_OOPS_QUOTA_FAILED_IMPERIAL = new string_id(EMPIRE_DAY, "oops_quota_failed_imp");
const string_id SID_CONGRATS_QUOTA_REBEL = new string_id(EMPIRE_DAY, "congratz_quota_accomplished_reb");
const string_id SID_OOPS_QUOTA_FAILED_REBEL = new string_id(EMPIRE_DAY, "oops_quota_failed_reb");
const string_id SID_NOT_SF = new string_id(EMPIRE_DAY, "no_longer_sf_redeclare");
const string_id SID_NOT_WHILE_MOUNTED = new string_id(EMPIRE_DAY, "not_while_monted");
const string_id SID_TOKEN_REWARDED = new string_id(EMPIRE_DAY, "token_rewarded");
const string_id SID_TOKENS_REWARDED = new string_id(EMPIRE_DAY, "tokens_rewarded");
const string EVENT_TRACKER_SCRIPT = "systems.spawning.spawned_tracker";
const string SMOKE_CLIENT_EFFECT = "appearance/pt_smoke_puff.prt";
//EMPIRE DAY COLLECTION NAMES
const string REBEL_RESISTANCE_COLLECTION = "remembrance_day_resistance_event";
const string REBEL_VANDAL_COLLECTION = "remembrance_day_vandal_event";
const string REBEL_ENGINEERING_COLLECTION = "remembrance_day_engineering_quest";
const string REBEL_ENTERTAINER_COLLECTION = "remembrance_day_performance_quest";
const string REBEL_RESCUE_COLLECTION = "remembrance_day_rescue_quest";
const string IMPERIAL_RECRUITING_COLLECTION = "empire_day_recruiting_event";
const string IMPERIAL_ANTIPROP_COLLECTION = "empire_day_anti_propaganda_event";
const string IMPERIAL_ENGINEERING_COLLECTION = "empire_day_engineering_quest";
const string IMPERIAL_ENTERTAINER_COLLECTION = "empire_day_performance_quest";
const string IMPERIAL_RESCUE_COLLECTION = "empire_day_rescue_quest";
//EMPIRE DAY COLLECTION STARTER SLOTS
const string REBEL_RESISTANCE_START_SLOT = "remembrance_day_resistance_starter";
const string REBEL_VANDAL_START_SLOT = "remembrance_day_vandal_starter";
const string REBEL_ENGINEERING_START_SLOT = "remembrance_day_engineering_starter";
const string REBEL_ENTERTAINER_START_SLOT = "remembrance_day_performance_starter";
const string REBEL_RESCUE_START_SLOT = "remembrance_day_rescue_starter";
const string IMPERIAL_RECRUITING_START_SLOT = "empire_day_recruitment_starter";
const string IMPERIAL_ANTIPROP_START_SLOT = "empire_day_anti_propaganda_starter";
const string IMPERIAL_ENGINEERING_START_SLOT = "empire_day_engineering_starter";
const string IMPERIAL_ENTERTAINER_START_SLOT = "empire_day_performance_starter";
const string IMPERIAL_RESCUE_START_SLOT = "empire_day_rescue_starter";
//EMPIRE DAY COLLECTION COUNTER SLOTS
const string REBEL_RESISTANCE_COUNTER_SLOT = "remembrance_day_resistance_counter";
const string REBEL_VANDAL_COUNTER_SLOT = "remembrance_day_vandal_counter";
const string REBEL_ENGINEERING_COUNTER_SLOT = "remembrance_day_engineering_counter";
const string REBEL_ENTERTAINER_COUNTER_SLOT = "remembrance_day_performance_counter";
const string REBEL_RESCUE_COUNTER_SLOT = "remembrance_day_rescue_counter";
const string IMPERIAL_RECRUITING_COUNTER_SLOT = "empire_day_recruitment_counter";
const string IMPERIAL_ANTIPROP_COUNTER_SLOT = "empire_day_anti_propaganda_counter";
const string IMPERIAL_ENGINEERING_COUNTER_SLOT = "empire_day_engineering_counter";
const string IMPERIAL_ENTERTAINER_COUNTER_SLOT = "empire_day_performance_counter";
const string IMPERIAL_RESCUE_COUNTER_SLOT = "empire_day_rescue_counter";
const string IMPERIAL_EMPTY_KIOSK = "object/tangible/event_perk/empire_day_missing_sign.iff";
const string REBEL_EMPTY_KIOSK = "object/tangible/event_perk/remembrance_day_missing_sign.iff";
const string IMPERIAL_NONPLAYER_RESISTANCE_KIOSK = "object/tangible/event_perk/remembrance_day_resistance_sign.iff";
const string IMPERIAL_PLAYER_RECRUITMENT_KIOSK = "object/tangible/event_perk/empire_day_player_placed_recruitment_sign.iff";
const string IMPERIAL_PLAYER_DEFACED_KIOSK = "object/tangible/event_perk/remembrance_day_player_defaced_sign.iff";
const string REBEL_NONPLAYER_RECRUITMENT_KIOSK = "object/tangible/event_perk/empire_day_recruitment_sign.iff";
const string REBEL_PLAYER_RESISTANCE_KIOSK = "object/tangible/event_perk/remembrance_day_player_resistance_sign.iff";
const string REBEL_PLAYER_DEFACED_KIOSK = "object/tangible/event_perk/empire_day_player_defaced_recruitment_sign.iff";
// Buff names
const string BUFF_IMP_EMPIREDAY_RECRUITMENT_COMBATANT = "event_empireday_imperial_recruitment_combatant";
const string BUFF_REB_EMPIREDAY_RESISTANCE_COMBATANT = "event_empireday_rebel_resistance_combatant";
const string BUFF_IMP_EMPIREDAY_RECRUITMENT_SF = "event_empireday_imperial_recruitment_special_forces";
const string BUFF_REB_EMPIREDAY_RESISTANCE_SF = "event_empireday_rebel_resistance_special_forces";
const string BUFF_IMP_EMPIREDAY_ANTIPROP_COMBATANT = "event_empireday_imperial_antipropaganda_combatant";
const string BUFF_REB_EMPIREDAY_VANDAL_COMBATANT = "event_empireday_rebel_vandal_combatant";
const string BUFF_IMP_EMPIREDAY_ANTIPROP_SF = "event_empireday_imperial_antipropaganda_special_forces";
const string BUFF_REB_EMPIREDAY_VANDAL_SF = "event_empireday_rebel_vandal_special_forces";
const string BUFF_IMPERIAL_RECRUITMENT_COUNTER = "event_empireday_imperial_recruitment_counter";
const string BUFF_REBEL_RESISTANCE_COUNTER = "event_empireday_rebel_resistance_counter";
const string BUFF_IMPERIAL_ANTIPROPAGANDA_COUNTER = "event_empireday_imperial_propaganda_counter";
const string BUFF_REBEL_PLAYER_VANDAL_COUNTER = "event_empireday_rebel_vandal_counter";
const string EMPIRE_DAY_BUFF_TRACKER = "event_empireday_first_buff_ended";
const string BUFF_COMBATANT_GROUP = "combatant";
const string BUFF_SF_GROUP = "special_forces";
const string BUFF_COUNTER_GROUP = "counter";
const string TOKEN_IMPERIAL_EMPIRE_DAY = "item_empire_day_imperial_token";
const string TOKEN_REBEL_EMPIRE_DAY = "item_empire_day_rebel_token";
const string EVENT_PREFIX = "empire_day_event.";
const string EMPIRE_DAY_RECRUITMENT_LOCKED_OUT = EVENT_PREFIX + "recruitment_locked_out";
const string EMPIRE_DAY_RESISTANCE_LOCKED_OUT = EVENT_PREFIX + "resistance_locked_out";
const string EMPIRE_DAY_PROPAGANDA_LOCKED_OUT = EVENT_PREFIX + "propaganda_locked_out";
const string EMPIRE_DAY_VANDAL_LOCKED_OUT = EVENT_PREFIX + "vandal_locked_out";
const string EMPIRE_DAY_RECRUITMENT_TIMESTAMP = EVENT_PREFIX + "event_recruitment_time_stamp";
const string EMPIRE_DAY_PROPAGANDA_TIMESTAMP = EVENT_PREFIX + "event_propaganda_time_stamp";
const string EMPIRE_DAY_RESISTANCE_TIMESTAMP = EVENT_PREFIX + "event_resistance_time_stamp";
const string EMPIRE_DAY_VANDAL_TIMESTAMP = EVENT_PREFIX + "event_vandal_time_stamp";
//ALL EMPIRE DAY TRADER QUESTS
const string EMPIREDAYQUEST_IMP_CRASHSITE_01_DOMESTICS = "crash_site_01_imp_domestics";
const string EMPIREDAYQUEST_IMP_CRASHSITE_02_DOMESTICS = "crash_site_02_imp_domestics";
const string EMPIREDAYQUEST_IMP_CRASHSITE_03_DOMESTICS = "crash_site_03_imp_domestics";
const string EMPIREDAYQUEST_IMP_CRASHSITE_04_DOMESTICS = "crash_site_04_imp_domestics";
const string EMPIREDAYQUEST_IMP_CRASHSITE_05_DOMESTICS = "crash_site_05_imp_domestics";
const string EMPIREDAYQUEST_IMP_CRASHSITE_06_DOMESTICS = "crash_site_06_imp_domestics";
const string EMPIREDAYQUEST_IMP_CRASHSITE_01_ENG = "crash_site_01_imp_engineering";
const string EMPIREDAYQUEST_IMP_CRASHSITE_02_ENG = "crash_site_02_imp_engineering";
const string EMPIREDAYQUEST_IMP_CRASHSITE_03_ENG = "crash_site_03_imp_engineering";
const string EMPIREDAYQUEST_IMP_CRASHSITE_04_ENG = "crash_site_04_imp_engineering";
const string EMPIREDAYQUEST_IMP_CRASHSITE_05_ENG = "crash_site_05_imp_engineering";
const string EMPIREDAYQUEST_IMP_CRASHSITE_06_ENG = "crash_site_06_imp_engineering";
const string EMPIREDAYQUEST_IMP_CRASHSITE_01_MUNITIONS = "crash_site_01_imp_munitions";
const string EMPIREDAYQUEST_IMP_CRASHSITE_02_MUNITIONS = "crash_site_02_imp_munitions";
const string EMPIREDAYQUEST_IMP_CRASHSITE_03_MUNITIONS = "crash_site_03_imp_munitions";
const string EMPIREDAYQUEST_IMP_CRASHSITE_04_MUNITIONS = "crash_site_04_imp_munitions";
const string EMPIREDAYQUEST_IMP_CRASHSITE_05_MUNITIONS = "crash_site_05_imp_munitions";
const string EMPIREDAYQUEST_IMP_CRASHSITE_06_MUNITIONS = "crash_site_06_imp_munitions";
const string EMPIREDAYQUEST_IMP_CRASHSITE_01_STRUC = "crash_site_01_imp_structures";
const string EMPIREDAYQUEST_IMP_CRASHSITE_02_STRUC = "crash_site_02_imp_structures";
const string EMPIREDAYQUEST_IMP_CRASHSITE_03_STRUC = "crash_site_03_imp_structures";
const string EMPIREDAYQUEST_IMP_CRASHSITE_04_STRUC = "crash_site_04_imp_structures";
const string EMPIREDAYQUEST_IMP_CRASHSITE_05_STRUC = "crash_site_05_imp_structures";
const string EMPIREDAYQUEST_IMP_CRASHSITE_06_STRUC = "crash_site_06_imp_structures";
const string EMPIREDAYQUEST_REB_CRASHSITE_01_DOMESTICS = "crash_site_01_reb_domestics";
const string EMPIREDAYQUEST_REB_CRASHSITE_02_DOMESTICS = "crash_site_02_reb_domestics";
const string EMPIREDAYQUEST_REB_CRASHSITE_03_DOMESTICS = "crash_site_03_reb_domestics";
const string EMPIREDAYQUEST_REB_CRASHSITE_04_DOMESTICS = "crash_site_04_reb_domestics";
const string EMPIREDAYQUEST_REB_CRASHSITE_05_DOMESTICS = "crash_site_05_reb_domestics";
const string EMPIREDAYQUEST_REB_CRASHSITE_06_DOMESTICS = "crash_site_06_reb_domestics";
const string EMPIREDAYQUEST_REB_CRASHSITE_01_ENG = "crash_site_01_reb_engineering";
const string EMPIREDAYQUEST_REB_CRASHSITE_02_ENG = "crash_site_02_reb_engineering";
const string EMPIREDAYQUEST_REB_CRASHSITE_03_ENG = "crash_site_03_reb_engineering";
const string EMPIREDAYQUEST_REB_CRASHSITE_04_ENG = "crash_site_04_reb_engineering";
const string EMPIREDAYQUEST_REB_CRASHSITE_05_ENG = "crash_site_05_reb_engineering";
const string EMPIREDAYQUEST_REB_CRASHSITE_06_ENG = "crash_site_06_reb_engineering";
const string EMPIREDAYQUEST_REB_CRASHSITE_01_MUNITIONS = "crash_site_01_reb_munitions";
const string EMPIREDAYQUEST_REB_CRASHSITE_02_MUNITIONS = "crash_site_02_reb_munitions";
const string EMPIREDAYQUEST_REB_CRASHSITE_03_MUNITIONS = "crash_site_03_reb_munitions";
const string EMPIREDAYQUEST_REB_CRASHSITE_04_MUNITIONS = "crash_site_04_reb_munitions";
const string EMPIREDAYQUEST_REB_CRASHSITE_05_MUNITIONS = "crash_site_05_reb_munitions";
const string EMPIREDAYQUEST_REB_CRASHSITE_06_MUNITIONS = "crash_site_06_reb_munitions";
const string EMPIREDAYQUEST_REB_CRASHSITE_01_STRUC = "crash_site_01_reb_structures";
const string EMPIREDAYQUEST_REB_CRASHSITE_02_STRUC = "crash_site_02_reb_structures";
const string EMPIREDAYQUEST_REB_CRASHSITE_03_STRUC = "crash_site_03_reb_structures";
const string EMPIREDAYQUEST_REB_CRASHSITE_04_STRUC = "crash_site_04_reb_structures";
const string EMPIREDAYQUEST_REB_CRASHSITE_05_STRUC = "crash_site_05_reb_structures";
const string EMPIREDAYQUEST_REB_CRASHSITE_06_STRUC = "crash_site_06_reb_structures";
const string EMPIREDAYQUEST_REB_ENTERTAINER_01 = "entertainer_rebel_01";
const string EMPIREDAYQUEST_REB_ENTERTAINER_02 = "entertainer_rebel_02";
const string EMPIREDAYQUEST_REB_ENTERTAINER_03 = "entertainer_rebel_03";
const string EMPIREDAYQUEST_REB_ENTERTAINER_04 = "entertainer_rebel_04";
const string EMPIREDAYQUEST_REB_ENTERTAINER_05 = "entertainer_rebel_05";
const string EMPIREDAYQUEST_REB_ENTERTAINER_06 = "entertainer_rebel_06";
const string EMPIREDAYQUEST_IMP_ENTERTAINER_01 = "entertainer_imperial_01";
const string EMPIREDAYQUEST_IMP_ENTERTAINER_02 = "entertainer_imperial_02";
const string EMPIREDAYQUEST_IMP_ENTERTAINER_03 = "entertainer_imperial_03";
const string EMPIREDAYQUEST_IMP_ENTERTAINER_04 = "entertainer_imperial_04";
const string EMPIREDAYQUEST_IMP_ENTERTAINER_05 = "entertainer_imperial_05";
const string EMPIREDAYQUEST_IMP_ENTERTAINER_06 = "entertainer_imperial_06";
const string EMPIREDAYQUEST_REB_COMBAT_01 = "recovery_quest_rebel_01";
const string EMPIREDAYQUEST_REB_COMBAT_02 = "recovery_quest_rebel_02";
const string EMPIREDAYQUEST_REB_COMBAT_03 = "recovery_quest_rebel_03";
const string EMPIREDAYQUEST_REB_COMBAT_04 = "recovery_quest_rebel_04";
const string EMPIREDAYQUEST_REB_COMBAT_05 = "recovery_quest_rebel_05";
const string EMPIREDAYQUEST_REB_COMBAT_06 = "recovery_quest_rebel_06";
const string EMPIREDAYQUEST_REB_COMBAT_07 = "recovery_quest_rebel_07";
const string EMPIREDAYQUEST_REB_COMBAT_AUTOGRAPH = "recovery_quest_rebel_autograph";
const string EMPIREDAYQUEST_REB_CORPSE_SIGNAL = "foundIntelRebelEmpireDay";
const string EMPIREDAYQUEST_REB_CORPSE_TASK = "waitForIntelRebelEmpireDay";
const string EMPIREDAYQUEST_IMP_COMBAT_01 = "recovery_quest_imperial_01";
const string EMPIREDAYQUEST_IMP_COMBAT_02 = "recovery_quest_imperial_02";
const string EMPIREDAYQUEST_IMP_COMBAT_03 = "recovery_quest_imperial_03";
const string EMPIREDAYQUEST_IMP_COMBAT_04 = "recovery_quest_imperial_04";
const string EMPIREDAYQUEST_IMP_COMBAT_05 = "recovery_quest_imperial_05";
const string EMPIREDAYQUEST_IMP_COMBAT_06 = "recovery_quest_imperial_06";
const string EMPIREDAYQUEST_IMP_COMBAT_07 = "recovery_quest_imperial_07";
const string EMPIREDAYQUEST_IMP_COMBAT_NUMBER = "recovery_quest_imperial_number";
const string EMPIREDAYQUEST_IMP_CORPSE_SIGNAL = "foundIntelImperialEmpireDay";
const string EMPIREDAYQUEST_IMP_CORPSE_TASK = "waitForIntelImperialEmpireDay";
const string VOL_TRIGGER_NAME_PREFIX = "empire_day_detainment_";
const string IMPERIAL_FLYBY_PARTICLE_01 = "appearance/pt_trailing_distant_tie_fighters_slower_s01.prt";
const string IMPERIAL_FLYBY_PARTICLE_02 = "appearance/pt_trailing_distant_tie_fighters_slower_s02.prt";
const string REBEL_FLYBY_PARTICLE_01 = "appearance/pt_trailing_distant_rebel_ships_slow_s01.prt";
const string REBEL_FLYBY_PARTICLE_02 = "appearance/pt_trailing_distant_rebel_ships_slow_s02.prt";
const string REBEL_FLYBY_PARTICLE_03 = "appearance/pt_trailing_distant_rebel_ships_slow_s03.prt";
const string REBEL_FLYBY_PARTICLE_04 = "appearance/pt_trailing_distant_rebel_ships_slow_s04.prt";
//Darth says "Congratulations <player>. From this day on you shall wear the title 'Hero of Empire Day'"
const string_id DARTH_BADGE_1 = new string_id(EMP_DAY, "imp_darth_badge_1");
//Darth says "Since you're not going to show the proper respect, we are done here. Consider yourself lucky I'm in a good mood <player>."
const string_id DARTH_BADGE_2 = new string_id(EMP_DAY, "imp_darth_badge_2");
//LEIA says "It is my honor to present to you <player>, Hero of Remembrance Day!"
const string_id LEIA_BADGE_1 = new string_id(EMP_DAY, "leia_badge_1");
//LEIA says "Since you're not going to take this seriously, we are done here. I'm disappointed in you %TT."
const string_id LEIA_BADGE_2 = new string_id(EMP_DAY, "leia_badge_2");
//Bow to celebrity
const string_id BOW = new string_id(EMP_DAY, "bow");
//THIS IS USED TO INCREASE OR DECREASE THE
//BADGES GIVEN BY EMPIRE/REMEMBRANCE DAY CELEBS
const int MAXIMUM_EMPIRE_DAY_WINNERS = 3;
const int EMPIRE_DAY_SECONDS_TO_START = 900; //should be 900
const float OBJECT_NEAR_CHECK_RANGE_250M = 250.0f;
const float OBJECT_NEAR_CHECK_RANGE_200M = 200.0f;
const float OBJECT_NEAR_CHECK_RANGE_100M = 100.0f; //THIS IS THE DEFAULT RANGE IN WHICH THE STATUE CHECKS FOR OBJECTS
const float OBJECT_NEAR_CHECK_RANGE_2M = 2.0f;
const float OBJECT_NEAR_CHECK_RANGE_10M = 10.0f;
const float NPC_ATTACK_RANGE = 30.0f;
const int IMPERIAL_PLAYER = 1;
const int REBEL_PLAYER = 2;
const int NEUTRAL_PLAYER = 3;
const int MIN_DESTROY_TIME = 60;
const int MAX_DESTROY_TIME = 180;
const int DAILY_COUNTER_LIMIT = 9;
const int TOKEN_AMOUNT_COMBATANT = 1;
const int TOKEN_AMOUNT_SF = 2;
const int GCW_AMOUNT_SF = 10;
const int GCW_AMOUNT_COMBATANT = 5;
const int DAILY_TIME = 10; //10 AM GMT
const int MAX_NUMBER_OF_PLANET_HIGH_SCORES = 5;
const float VOL_TRIGGER_RADIUS = 20f;
//THIS CONSTANT GOVERNS THE EVENT START IN A FEW LOCATIONS
const float EMPIRE_DAY_EVENT_START_DELAY = 700.f; //should be 700.f
// Ewok Festival of Love
const string LOVEDAY_CUPID_MANAGER_NAME = "loveday_cupid_manager";
const string LOVEDAY_CUPID_ELEMENT_NAME = "loveday_cupid_spawner_";
const string LOVEDAY_CUPID_SPAWNER_CITY_VAR = "loveday_city";
const string GETTING_CUPID_SPAWNER_IDS = "manager_gettingCupidSpawnerIds";
const string[] LOVEDAY_LOCATIONS = {"endor", "kaadara", "tyrena"};
const string ROMANCE_TRAITS_TABLE = "datatables/event/loveday/playing_cupid.iff";
const string[] MATCHMAKING_COMPANIONS = { "loveday_romance_seeker_familiar_male_01",
"loveday_romance_seeker_familiar_male_02",
"loveday_romance_seeker_familiar_male_03",
"loveday_romance_seeker_familiar_male_04",
"loveday_romance_seeker_familiar_female_01",
"loveday_romance_seeker_familiar_female_02",
"loveday_romance_seeker_familiar_female_03",
"loveday_romance_seeker_familiar_female_04" };
const string[] MATCHMAKING_COMPANIONS_SLOTS = { "loveday_2010_matched_jeffrey",
"loveday_2010_matched_matthew",
"loveday_2010_matched_gerald",
"loveday_2010_matched_daniel",
"loveday_2010_matched_caroline",
"loveday_2010_matched_francine",
"loveday_2010_matched_julia",
"loveday_2010_matched_ellen" };
const string[] ALL_IMPERIAL_CRATE_TEMPLATES =
{
"object/tangible/holiday/empire_day/e11_gas_cartridge_crate.iff",
"object/tangible/holiday/empire_day/imperial_second_lieutenant_rank_crate.iff",
"object/tangible/holiday/empire_day/improved_mouse_droid_arm_crate.iff",
"object/tangible/holiday/empire_day/command_console_comscan_subcomponent_crate.iff"
};
const string[] ALL_REBEL_CRATE_TEMPLATES =
{
"object/tangible/holiday/empire_day/aa1n_vebrobrain_protocol_droid_component_crate.iff",
"object/tangible/holiday/empire_day/rebel_trooper_field_rations_crate.iff",
"object/tangible/holiday/empire_day/crew_carrier_steering_mechanism_crate.iff",
"object/tangible/holiday/empire_day/dh17_gas_cartridge_crate.iff"
};
const string[] ALL_IMPERIAL_QUESTS =
{
EMPIREDAYQUEST_IMP_CRASHSITE_01_DOMESTICS,
EMPIREDAYQUEST_IMP_CRASHSITE_02_DOMESTICS,
EMPIREDAYQUEST_IMP_CRASHSITE_03_DOMESTICS,
EMPIREDAYQUEST_IMP_CRASHSITE_04_DOMESTICS,
EMPIREDAYQUEST_IMP_CRASHSITE_05_DOMESTICS,
EMPIREDAYQUEST_IMP_CRASHSITE_06_DOMESTICS,
EMPIREDAYQUEST_IMP_CRASHSITE_01_ENG,
EMPIREDAYQUEST_IMP_CRASHSITE_02_ENG,
EMPIREDAYQUEST_IMP_CRASHSITE_03_ENG,
EMPIREDAYQUEST_IMP_CRASHSITE_04_ENG,
EMPIREDAYQUEST_IMP_CRASHSITE_05_ENG,
EMPIREDAYQUEST_IMP_CRASHSITE_06_ENG,
EMPIREDAYQUEST_IMP_CRASHSITE_01_MUNITIONS,
EMPIREDAYQUEST_IMP_CRASHSITE_02_MUNITIONS,
EMPIREDAYQUEST_IMP_CRASHSITE_03_MUNITIONS,
EMPIREDAYQUEST_IMP_CRASHSITE_04_MUNITIONS,
EMPIREDAYQUEST_IMP_CRASHSITE_05_MUNITIONS,
EMPIREDAYQUEST_IMP_CRASHSITE_06_MUNITIONS,
EMPIREDAYQUEST_IMP_CRASHSITE_01_STRUC,
EMPIREDAYQUEST_IMP_CRASHSITE_02_STRUC,
EMPIREDAYQUEST_IMP_CRASHSITE_03_STRUC,
EMPIREDAYQUEST_IMP_CRASHSITE_04_STRUC,
EMPIREDAYQUEST_IMP_CRASHSITE_05_STRUC,
EMPIREDAYQUEST_IMP_CRASHSITE_06_STRUC
};
const string[] ALL_REBEL_QUESTS =
{
EMPIREDAYQUEST_REB_CRASHSITE_01_DOMESTICS,
EMPIREDAYQUEST_REB_CRASHSITE_02_DOMESTICS,
EMPIREDAYQUEST_REB_CRASHSITE_03_DOMESTICS,
EMPIREDAYQUEST_REB_CRASHSITE_04_DOMESTICS,
EMPIREDAYQUEST_REB_CRASHSITE_05_DOMESTICS,
EMPIREDAYQUEST_REB_CRASHSITE_06_DOMESTICS,
EMPIREDAYQUEST_REB_CRASHSITE_01_ENG,
EMPIREDAYQUEST_REB_CRASHSITE_02_ENG,
EMPIREDAYQUEST_REB_CRASHSITE_03_ENG,
EMPIREDAYQUEST_REB_CRASHSITE_04_ENG,
EMPIREDAYQUEST_REB_CRASHSITE_05_ENG,
EMPIREDAYQUEST_REB_CRASHSITE_06_ENG,
EMPIREDAYQUEST_REB_CRASHSITE_01_MUNITIONS,
EMPIREDAYQUEST_REB_CRASHSITE_02_MUNITIONS,
EMPIREDAYQUEST_REB_CRASHSITE_03_MUNITIONS,
EMPIREDAYQUEST_REB_CRASHSITE_04_MUNITIONS,
EMPIREDAYQUEST_REB_CRASHSITE_05_MUNITIONS,
EMPIREDAYQUEST_REB_CRASHSITE_06_MUNITIONS,
EMPIREDAYQUEST_REB_CRASHSITE_01_STRUC,
EMPIREDAYQUEST_REB_CRASHSITE_02_STRUC,
EMPIREDAYQUEST_REB_CRASHSITE_03_STRUC,
EMPIREDAYQUEST_REB_CRASHSITE_04_STRUC,
EMPIREDAYQUEST_REB_CRASHSITE_05_STRUC,
EMPIREDAYQUEST_REB_CRASHSITE_06_STRUC
};
const string[] ALL_IMPERIAL_QUEST_TEMPLATES =
{
ALL_IMPERIAL_CRATE_TEMPLATES[1],
ALL_IMPERIAL_CRATE_TEMPLATES[1],
ALL_IMPERIAL_CRATE_TEMPLATES[1],
ALL_IMPERIAL_CRATE_TEMPLATES[1],
ALL_IMPERIAL_CRATE_TEMPLATES[1],
ALL_IMPERIAL_CRATE_TEMPLATES[1],
ALL_IMPERIAL_CRATE_TEMPLATES[2],
ALL_IMPERIAL_CRATE_TEMPLATES[2],
ALL_IMPERIAL_CRATE_TEMPLATES[2],
ALL_IMPERIAL_CRATE_TEMPLATES[2],
ALL_IMPERIAL_CRATE_TEMPLATES[2],
ALL_IMPERIAL_CRATE_TEMPLATES[2],
ALL_IMPERIAL_CRATE_TEMPLATES[0],
ALL_IMPERIAL_CRATE_TEMPLATES[0],
ALL_IMPERIAL_CRATE_TEMPLATES[0],
ALL_IMPERIAL_CRATE_TEMPLATES[0],
ALL_IMPERIAL_CRATE_TEMPLATES[0],
ALL_IMPERIAL_CRATE_TEMPLATES[0],
ALL_IMPERIAL_CRATE_TEMPLATES[3],
ALL_IMPERIAL_CRATE_TEMPLATES[3],
ALL_IMPERIAL_CRATE_TEMPLATES[3],
ALL_IMPERIAL_CRATE_TEMPLATES[3],
ALL_IMPERIAL_CRATE_TEMPLATES[3],
ALL_IMPERIAL_CRATE_TEMPLATES[3]
};
const string[] ALL_REBEL_QUEST_TEMPLATES =
{
ALL_REBEL_CRATE_TEMPLATES[1],
ALL_REBEL_CRATE_TEMPLATES[1],
ALL_REBEL_CRATE_TEMPLATES[1],
ALL_REBEL_CRATE_TEMPLATES[1],
ALL_REBEL_CRATE_TEMPLATES[1],
ALL_REBEL_CRATE_TEMPLATES[1],
ALL_REBEL_CRATE_TEMPLATES[0],
ALL_REBEL_CRATE_TEMPLATES[0],
ALL_REBEL_CRATE_TEMPLATES[0],
ALL_REBEL_CRATE_TEMPLATES[0],
ALL_REBEL_CRATE_TEMPLATES[0],
ALL_REBEL_CRATE_TEMPLATES[0],
ALL_REBEL_CRATE_TEMPLATES[3],
ALL_REBEL_CRATE_TEMPLATES[3],
ALL_REBEL_CRATE_TEMPLATES[3],
ALL_REBEL_CRATE_TEMPLATES[3],
ALL_REBEL_CRATE_TEMPLATES[3],
ALL_REBEL_CRATE_TEMPLATES[3],
ALL_REBEL_CRATE_TEMPLATES[2],
ALL_REBEL_CRATE_TEMPLATES[2],
ALL_REBEL_CRATE_TEMPLATES[2],
ALL_REBEL_CRATE_TEMPLATES[2],
ALL_REBEL_CRATE_TEMPLATES[2],
ALL_REBEL_CRATE_TEMPLATES[2]
};
const string[] ALL_REBEL_ENTERTAINER_QUESTS =
{
EMPIREDAYQUEST_REB_ENTERTAINER_01,
EMPIREDAYQUEST_REB_ENTERTAINER_02,
EMPIREDAYQUEST_REB_ENTERTAINER_03,
EMPIREDAYQUEST_REB_ENTERTAINER_04,
EMPIREDAYQUEST_REB_ENTERTAINER_05,
EMPIREDAYQUEST_REB_ENTERTAINER_06
};
const string[] ALL_IMPERIAL_ENTERTAINER_QUESTS =
{
EMPIREDAYQUEST_IMP_ENTERTAINER_01,
EMPIREDAYQUEST_IMP_ENTERTAINER_02,
EMPIREDAYQUEST_IMP_ENTERTAINER_03,
EMPIREDAYQUEST_IMP_ENTERTAINER_04,
EMPIREDAYQUEST_IMP_ENTERTAINER_05,
EMPIREDAYQUEST_IMP_ENTERTAINER_06
};
const string[] DEFAULT_HIGH_SCORE_LIST =
{
"DevH",
"Loche",
"Milbarge",
"Jaskell",
"AdeptStrain",
"DeadMeat",
"CancelAutoRun",
"Dotanuki",
"Tereb",
"Hanse",
"Teesquared",
"DevH",
"Loche",
"Milbarge",
"Jaskell",
"AdeptStrain",
"Swede",
"Blixtev",
"DeadMeat",
"CancelAutoRun",
"Dotanuki",
"Tereb",
"Hanse",
"Teesquared"
};
/***** TRIGGERS ********************************************************/
/***** FUNCTIONS *******************************************************/
boolean hasLovedayRomanceSeekerCompanion(obj_id player)
{
return isIdValid(getLovedayRomanceSeekerCompanionControlDevice(player));
}
obj_id getLovedayRomanceSeekerCompanionControlDevice(obj_id player)
{
obj_id datapad = utils.getPlayerDatapad(player);
if( isIdValid(datapad) )
{
obj_id[] dataItems = getContents(datapad);
if( dataItems != null || dataItems.length > 0 )
{
for(int i = 0; i < dataItems.length; i++)
{
obj_id dataItem = dataItems[i];
if( hasObjVar(dataItem, "pet.creatureName") )
{
if ( getStringObjVar(dataItem, "pet.creatureName").startsWith("loveday_romance_seeker_familiar") )
{
return dataItem;
}
}
}
}
}
return obj_id.NULL_ID;
}
boolean grantLovedayRomanceSeekerCompanion(obj_id player)
{
if ( !hasLovedayRomanceSeekerCompanion(player) )
{
string seekerChoice = MATCHMAKING_COMPANIONS[rand(0, MATCHMAKING_COMPANIONS.length-1)];
if ( utils.hasScriptVar(player, "loveday.todaysCompanion") )
{
seekerChoice = utils.getStringScriptVar(player, "loveday.todaysCompanion");
}
obj_id controlDevice = pet_lib.generatePetOfTypeFamiliar(seekerChoice, player);
if ( isIdValid( controlDevice ) )
{
setObjVar(controlDevice, "item.lifespan", 86400); // 24 hours
attachScript(controlDevice, "item.special.temporary_item" );
int chosenSet = getRomanticTraitsSet();
if ( utils.hasScriptVar(player, "loveday.todaysCompanionTraits") )
{
chosenSet = utils.getIntScriptVar(player, "loveday.todaysCompanionTraits");
}
setRomanticTraits(controlDevice, chosenSet);
//utils.setScriptVar(player, "loveday.todaysCompanion", seekerChoice);
utils.setScriptVar(player, "loveday.todaysCompanionTraits", chosenSet);
return true;
}
}
return false;
}
void checkForAndGrantLovedayMatchmakingSlot(obj_id player, string companionType)
{
if ( !isIdValid(player) )
{
return;
}
if ( companionType == null || companionType.length() < 1 )
{
return;
}
int index = utils.getElementPositionInArray(MATCHMAKING_COMPANIONS, companionType);
if ( index > -1 )
{
string companionSlotName = MATCHMAKING_COMPANIONS_SLOTS[index];
if ( !hasCompletedCollectionSlot(player, companionSlotName) )
{
modifyCollectionSlotValue(player, companionSlotName, 1);
}
}
return;
}
int getNumRomanticTraitsSets()
{
int numRows = dataTableGetNumRows(ROMANCE_TRAITS_TABLE);
return numRows;
}
int getRomanticTraitsSet()
{
int numSets = getNumRomanticTraitsSets();
int chosenSet = rand(0, numSets - 1);
return chosenSet;
}
void setRomanticTraits(obj_id npc, int chosenSet)
{
dictionary traits = dataTableGetRow(ROMANCE_TRAITS_TABLE, chosenSet);
setObjVar(npc, "playingCupid.traitSet", chosenSet);
setObjVar(npc, "playingCupid.trait_01", traits.getString("trait_01"));
setObjVar(npc, "playingCupid.trait_02", traits.getString("trait_02"));
setObjVar(npc, "playingCupid.trait_03", traits.getString("trait_03"));
setObjVar(npc, "playingCupid.trait_04", traits.getString("trait_04"));
setObjVar(npc, "playingCupid.trait_05", traits.getString("trait_05"));
return;
}
boolean playEmpireDayFireWorksAndFlyBys(obj_id masterObject, int faction)
{
CustomerServiceLog("holidayEvent", "emperor_statue.playFireWorksAndFlyBys: Function initialized.");
if(!isValidId(masterObject) || !exists(masterObject))
return false;
if(faction <= 0)
return false;
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 3.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 5.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 6.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 10.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 5.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 7.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 9.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 11.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 13.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 15.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 16.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 17.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 18.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 18.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 18.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 18.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 19.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 19.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 19.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 19.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 20.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 20.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 20.0f, false);
messageTo(masterObject, "launchRandomNonFactionalFirework", null, 20.0f, false);
messageTo(masterObject, "launchFactionalFirework", null, 5.0f, false);
messageTo(masterObject, "launchFactionalFirework", null, 10.0f, false);
messageTo(masterObject, "launchFactionalFirework", null, 15.0f, false);
messageTo(masterObject, "launchFactionalFirework", null, 20.0f, false);
if(faction == IMPERIAL_PLAYER)
{
messageTo(masterObject, "launchRandomTieFighterFlyBy", null, 4, false);
messageTo(masterObject, "launchRandomTieFighterFlyBy", null, 8, false);
messageTo(masterObject, "launchRandomTieFighterFlyBy", null, 12, false);
messageTo(masterObject, "launchRandomTieFighterFlyBy", null, 2, false);
messageTo(masterObject, "launchRandomTieFighterFlyBy", null, 6, false);
messageTo(masterObject, "launchRandomTieFighterFlyBy", null, 10, false);
}
else
{
messageTo(masterObject, "launchRandomRebelShipFlyBy", null, 4, false);
messageTo(masterObject, "launchRandomRebelShipFlyBy", null, 8, false);
messageTo(masterObject, "launchRandomRebelShipFlyBy", null, 12, false);
messageTo(masterObject, "launchRandomRebelShipFlyBy", null, 2, false);
messageTo(masterObject, "launchRandomRebelShipFlyBy", null, 6, false);
messageTo(masterObject, "launchRandomRebelShipFlyBy", null, 10, false);
}
return true;
}
string getEmpireDayEligibility(obj_id player, int faction)
{
if(!isValidId(player) || !exists(player))
return null;
if(faction <= 0)
return null;
if(holiday.isEmpireDayPlayerEligible(player, faction))
{
if(faction == IMPERIAL_PLAYER)
{
return "You are eligible for the Champion of Empire Day badge from Darth Vader.";
}
else
{
return "You are eligible for the Champion of Remembrance Day badge from Princess Leia.";
}
}
if(faction == IMPERIAL_PLAYER)
{
return "You are NOT eligible for the Champion of Empire Day badge from Darth Vader.";
}
else
{
return "You are NOT eligible for the Champion of Remembrance Day badge from Princess Leia.";
}
}
/*
isEmpireDayPlayerEligible(obj_id player) Dictates the player's eligibility for
Empire and Remembrance Day Badges
*/
boolean isEmpireDayPlayerEligible(obj_id player, int faction)
{
if(!isValidId(player) || !exists(player))
return false;
if(faction == IMPERIAL_PLAYER && !factions.isImperial(player))
return false;
if(faction == REBEL_PLAYER && !factions.isRebel(player))
return false;
int tooYoung = getCurrentBirthDate() - getPlayerBirthDate(player);
if(tooYoung < 10)
return false;
if(
isPlayerConnected(player)
&& !isAwayFromKeyBoard(player)
&& !hasCompletedCollectionSlot(player, holiday.EMPIRE_DAY_CHAMPION_BADGE)
&& !hasCompletedCollectionSlot(player, holiday.REMEMBRANCE_DAY_CHAMPION_BADGE)
&& !isGod(player)
&& !isDead(player)
&& !ai_lib.isInCombat(player)
&& !isIncapacitated(player)
&& !utils.isFreeTrial(player)
&& isInWorldCell(player)
)
{
return true;
}
return false;
}
obj_id[] getEmpireDayWinningPlayers(obj_id holidayObject, resizeable obj_id[] eligiblePlayers)
{
CustomerServiceLog("holidayEvent", "holiday.getEmpireDayWinningPlayers: init");
if(!isIdValid(holidayObject) || !exists(holidayObject))
return null;
//CASE 1 - No eligible players
if(eligiblePlayers == null || eligiblePlayers.length <= 0)
return null;
int maxEmpireDayWinners = MAXIMUM_EMPIRE_DAY_WINNERS;
string empiredayWinnerConfig = getConfigSetting("GameServer", "empireday_ceremony_winners");
if(empiredayWinnerConfig != null && utils.stringToInt(empiredayWinnerConfig) > -1)
{
CustomerServiceLog("holidayEvent", "holiday.getEmpireDayWinningPlayers: The max badge winners was: "+maxEmpireDayWinners+" but there is a server config that might overwrite this amount.");
int configWinners = utils.stringToInt(empiredayWinnerConfig);
CustomerServiceLog("holidayEvent", "holiday.getEmpireDayWinningPlayers: The server config shows the max badge winners should be: "+configWinners+" checking to see if that is less or more than the current amount.");
if(configWinners != maxEmpireDayWinners)
{
CustomerServiceLog("holidayEvent", "holiday.getEmpireDayWinningPlayers: The server config if a different amount than the current max so we are using the server config.");
maxEmpireDayWinners = configWinners;
}
}
int originalListSize = eligiblePlayers.length;
//CASE 2 - Exactly the minimun winners or less
if(originalListSize <= maxEmpireDayWinners)
{
CustomerServiceLog("holidayEvent", "holiday.getEmpireDayWinningPlayers: There is less than "+maxEmpireDayWinners+" or exactly "+maxEmpireDayWinners+" winning players");
for(int i = 0; i < eligiblePlayers.length; ++i)
{
CustomerServiceLog("holidayEvent", "holiday.getEmpireDayWinningPlayers: Player "+ getPlayerName(eligiblePlayers[i]) + "(" + eligiblePlayers[i] + ") was selected for badge.");
}
return eligiblePlayers;
}
CustomerServiceLog("holidayEvent", "holiday.getEmpireDayWinningPlayers: creating lists of players and winners.");
resizeable obj_id[] winningPlayers = new obj_id[0];
CustomerServiceLog("holidayEvent", "holiday.getEmpireDayWinningPlayers: originalListSize: "+originalListSize);
for (int i = 0; i < maxEmpireDayWinners; i++)
{
int randomWinner = rand(0, (eligiblePlayers.length-1));
if(randomWinner > (eligiblePlayers.length -1))
continue;
obj_id playerId = eligiblePlayers[randomWinner];
if(!isIdValid(playerId))
continue;
string playerName = getPlayerName(playerId);
//Grab the player and put him/her into the new resizable
winningPlayers.add(playerId);
/*
We remove that same player from the original array
to avoid picking the same one twice.
We also make the original resizable array smaller in the process
making sure we don't go out of bounds for the next random winner
*/
CustomerServiceLog("holidayEvent", "holiday.getEmpireDayWinningPlayers: Player "+ playerName + "(" + playerId + ") was selected for badge.");
eligiblePlayers.remove(playerId);
//Error checking
if(eligiblePlayers.length >= (originalListSize - i))
{
CustomerServiceLog("holidayEvent", "holiday.getEmpireDayWinningPlayers: Error with eligiblePlayers list. It did not remove a player on iteration: "+i);
break;
}
else if(winningPlayers.length <= (0 + i))
{
CustomerServiceLog("holidayEvent", "holiday.getEmpireDayWinningPlayers: Error with winningPlayers list. Did not add a player properly on iteration: "+i);
break;
}
}
return winningPlayers;
}
string currentYearObjVar()
{
//manually update this const value every year
return EMPIRE_DAY_RECEIVED_VII;
}
boolean grantEmpireDayGift(obj_id player, int faction)
{
if(!isIdValid(player))
return false;
if(faction <= 0)
return false;
CustomerServiceLog("grantGift", getFirstName(player) + "(" + player + ") is about to receive event gifts");
string eventGiftOne = IMPERIAL_AND_REBEL_EVENT_GIFT;
string eventGiftTwo = "";
if(faction == REBEL_PLAYER)
{
CustomerServiceLog("grantGift", getFirstName(player) + "(" + player + ") has been identified as faction: "+faction+" so the player will receive appropriate factional gifts");
eventGiftTwo = REBEL_REMEMBRANCE_DAY_GIFT;
}
else
{
CustomerServiceLog("grantGift", getFirstName(player) + "(" + player + ") has been identified as faction: "+faction+" so the player will receive appropriate factional gifts");
eventGiftTwo = IMPERIAL_EMPIRE_DAY_GIFT;
}
obj_id inv = utils.getInventoryContainer(player);
if(!isValidId(inv) || !exists(inv))
{
CustomerServiceLog("grantGift", getFirstName(player) + "(" + player + ") did not have a valid inventory. exiting without giving gifts.");
return false;
}
obj_id giftOne = static_item.createNewItemFunction(eventGiftOne, inv);
if(!isValidId(giftOne) || !exists(giftOne))
{
CustomerServiceLog("grantGift", getFirstName(player) + "(" + player + ") failed to receive gift one: "+eventGiftOne+" this may be due to having a full inventory or the item being corrupted.");
return false;
}
obj_id giftTwo = static_item.createNewItemFunction(eventGiftTwo, inv);
if(!isValidId(giftTwo) || !exists(giftTwo))
{
CustomerServiceLog("grantGift", getFirstName(player) + "(" + player + ") failed to receive gift one: "+eventGiftTwo+" this may be due to having a full inventory or the item being corrupted.");
return false;
}
setObjVar(player, holiday.currentYearObjVar(), 1);
if(faction == IMPERIAL_PLAYER)
{
sendSystemMessage(player, GIFT_GRANTED);
}
else
{
sendSystemMessage(player, GIFT_GRANTED_REBEL);
}
CustomerServiceLog("grantGift", getFirstName(player) + "(" + player + ") has received "+faction+" gifts: "+eventGiftOne+" and "+eventGiftTwo);
return true;
}
int getEmoteBeligerence(string emote)
{
if(emote == null || emote.length() <= 0)
{
return 2;
}
int emote_row = dataTableSearchColumnForString(emote, 0, EMOTE_DATATABLE);
if(emote_row <= 0)
{
return 2;
}
int st_emote_type = dataTableGetInt(EMOTE_DATATABLE, emote_row, 1);
if(st_emote_type <= 0)
{
return 2;
}
if(st_emote_type == 2)
{
return 2;
}
else if (st_emote_type == 1)
{
return 1;
}
else if (st_emote_type == 0)
{
return 0;
}
else
{
return -1;
}
}
obj_id getEmpireDayWaypointObjectObjId(obj_id object, string waypoint, float range)
{
if(!isIdValid(object) || !exists(object))
return null;
if(waypoint == null || waypoint.equals(""))
return null;
if(range <= 0)
return null;
location loc = getLocation(object);
if(loc == null)
return null;
obj_id[] objects = getObjectsInRange(loc, range);
for (int i = 0; i < objects.length; i++)
{
if (isIdValid(objects[i]))
{
if (hasObjVar(objects[i], waypoint))
{
obj_id waypointObjId = objects[i];
return waypointObjId;
}
}
}
return null;
}
obj_id masterObjectObjId(obj_id self)
{
location loc = getLocation(self);
obj_id[] objects = getObjectsInRange(loc, OBJECT_NEAR_CHECK_RANGE_100M);
for (int i = 0; i < objects.length; i++)
{
if (isIdValid(objects[i]))
{
if (hasObjVar(objects[i], "emperorsday.master"))
{
obj_id masterObjId = objects[i];
return masterObjId;
}
}
}
return null;
}
boolean giveCeremonyAreaMobsHate(obj_id player, float range)
{
if(!isIdValid(player) || !exists(player))
return false;
if(range <= 0)
range = 10.0f;
if(range > 100)
range = 100.0f;
location playerLoc = getLocation(player);
if(playerLoc == null)
return false;
obj_id[] allMobsCombat = getAllNpcs(playerLoc, range);
if(allMobsCombat == null || allMobsCombat.length <= 0)
return false;
for(int i = 0; i < allMobsCombat.length; i++)
{
//LOG("collection","mob hate added to: "+allMobsCombat[i]);
if(allMobsCombat[i] == player)
continue;
if(isInvulnerable(allMobsCombat[i]))
continue;
if(!pvpCanAttack(allMobsCombat[i], player))
continue;
startCombat(allMobsCombat[i], player);
}
return true;
}
boolean grantEmperorDayBadge(obj_id player, obj_id celeb, obj_id[] listOfWinners, int faction)
{
//Making sure master object is still around
obj_id masterObject = holiday.masterObjectObjId(celeb);
if(!isIdValid(masterObject) && !exists(masterObject))
{
CustomerServiceLog("holidayEvent", "imperial_npc.grantEmperorDayBadge: No Emperor Statue Found! Player: "+player+" cannot receive rewards from Vader!");
return false;
}
if(listOfWinners == null || listOfWinners.length <= 0)
{
CustomerServiceLog("holidayEvent", "imperial_npc.grantEmperorDayBadge: The list of winners was not found. Vader cannot give the player his badge.");
return false;
}
boolean foundPlayerObjVar = false;
for(int i = 0;i < listOfWinners.length; i++)
{
obj_id playerOid = getObjIdObjVar(celeb, "readyForBadge.winner_"+(i+1));
if(playerOid != player)
continue;
CustomerServiceLog("holidayEvent", "imperial_npc.grantEmperorDayBadge: The player: "+player+" OID was found on Vader, removing it and awarding player badge.");
foundPlayerObjVar = true;
removeObjVar(celeb, "readyForBadge.winner_"+(i+1));
}
if(!foundPlayerObjVar)
{
CustomerServiceLog("holidayEvent", "imperial_npc.grantEmperorDayBadge: The player's objvar was not found. Vader cannot give the player his badge.");
return false;
}
doAnimationAction(celeb, "nod_head_once");
doAnimationAction(player, "bow2");
utils.removeScriptVar(player, "emperorsDayBadge");
if(faction == IMPERIAL_PLAYER)
{
if(!badge.grantBadge(player, holiday.EMPIRE_DAY_CHAMPION_BADGE))
{
CustomerServiceLog("holidayEvent", "imperial_npc.grantEmperorDayBadge: Could not modify badge slot: "+holiday.EMPIRE_DAY_CHAMPION_BADGE+" for Player: "+player+". Player cannot receive rewards from Vader!");
return false;
}
factions.addFactionStanding(player, factions.FACTION_IMPERIAL, 250);
prose_package pp2 = prose.getPackage(DARTH_BADGE_1);
prose.setTT (pp2, player);
chat.chat(celeb, player, pp2);
CustomerServiceLog("holidayEvent", "imperial_npc.grantEmperorDayBadge: Player: "+player+" has received their badge.");
return true;
}
if(!badge.grantBadge(player, holiday.REMEMBRANCE_DAY_CHAMPION_BADGE))
{
CustomerServiceLog("holidayEvent", "imperial_npc.grantEmperorDayBadge: Could not modify badge slot: "+holiday.EMPIRE_DAY_CHAMPION_BADGE+" for Player: "+player+". Player cannot receive rewards from Vader!");
return false;
}
factions.addFactionStanding(player, factions.FACTION_REBEL, 250);
prose_package pp2 = prose.getPackage(LEIA_BADGE_1);
prose.setTT (pp2, player);
chat.chat(celeb, player, pp2);
doAnimationAction(celeb, "clap_rousing");
messageTo(masterObject, "hanHappy", null, 2.0f, false);
return true;
}
boolean slapPlayerDownForBeingRude(obj_id npcObject, obj_id playerToBeIncapped)
{
if(!isValidId(npcObject) && !exists(npcObject))
return false;
if(!isValidId(playerToBeIncapped) && !exists(playerToBeIncapped))
return false;
stealth.testInvisNonCombatAction(playerToBeIncapped, npcObject);
doAnimationAction(npcObject, "stop" );
dictionary eDict = new dictionary();
eDict.put("myTarget", playerToBeIncapped);
messageTo(npcObject, "playerKnockedOut", eDict, 0, false);
return true;
}
//Presents have been stomped or Tree has been dressed. Handle payout and changing object.
boolean replaceEventObject(obj_id eventObject, obj_id player, string objectTemplate)
{
if(!isValidId(eventObject) || !exists(eventObject))
return false;
if(!isValidId(player) || !exists(player))
return false;
if(objectTemplate == null || objectTemplate.equals(""))
return false;
//Transferring obj and script vars for the spawn system to the new object.
if(!hasObjVar(eventObject, "objParent"))
{
CustomerServiceLog("holidayEvent", "holiday.replaceEventObject: object " + eventObject + " doesn't have the object parent objvar so it will be destroyed and the player receives no credit.");
trial.cleanupObject(eventObject);
return false;
}
obj_id objParent = getObjIdObjVar(eventObject, "objParent");
if(!isValidId(objParent) || !exists(objParent))
{
CustomerServiceLog("holidayEvent", "holiday.replaceEventObject: object " + eventObject + " could not find parent object: "+objParent+" so it will be destroyed and the player receives no credit.");
trial.cleanupObject(eventObject);
return false;
}
if(!utils.hasScriptVar(eventObject, "deathTracker"))
{
CustomerServiceLog("holidayEvent", "holiday.replaceEventObject: object " + eventObject + " did not have the deathTracker scriptvar so it will be destroyed and the player receives no credit.");
trial.cleanupObject(eventObject);
return false;
}
float respawnTime = 20.f;
if(hasObjVar(eventObject, "fltRespawnTime"))
respawnTime = getFloatObjVar(eventObject, "fltRespawnTime");
location loc = utils.getLocationScriptVar(eventObject, "deathTracker");
if(loc == null)
{
CustomerServiceLog("holidayEvent", "holiday.replaceEventObject: object " + eventObject + " had a corrupt location so it will be destroyed and the player receives no credit.");
trial.cleanupObject(eventObject);
return false;
}
obj_id replacementEventObject = createObject(objectTemplate, loc);
if(!isValidId(objParent) || !exists(objParent))
{
CustomerServiceLog("holidayEvent", "holiday.replaceEventObject: object " + eventObject + " could not spawn a replacement object. This is likely due to an incorrect replacement template string. The event object will be destroyed and the player receives no credit.");
trial.cleanupObject(eventObject);
return false;
}
float yaw = getYaw(eventObject);
CustomerServiceLog("holidayEvent", "holiday.replaceEventObject: object " + eventObject + " did not have the deathTracker scriptvar so it will be destroyed and the plaeyr receives no credit.");
setObjVar(eventObject, "dontCountDeath", 1);
setObjVar(replacementEventObject, "objParent", objParent);
setObjVar(replacementEventObject, "fltRespawnTime", respawnTime);
utils.setScriptVar(replacementEventObject, "deathTracker", loc);
setYaw(replacementEventObject, yaw);
attachScript(replacementEventObject, "systems.spawning.spawned_tracker");
playClientEffectLoc(player, SMOKE_CLIENT_EFFECT, loc, 0);
trial.cleanupObject(eventObject);
return true;
}
boolean rewardEmpireDayPlayer(obj_id player, int playerFaction, string parentBuffName, string childBuffName, string collectionSlot, string eventName)
{
CustomerServiceLog("holidayEvent", "holiday.rewardEmpireDayPlayer: Player " + player + " is attempting to increment the childcounter buff: "+childBuffName+".");
if(!isValidId(player) || !exists(player))
return false;
if(playerFaction < 0 || (playerFaction != IMPERIAL_PLAYER && playerFaction != REBEL_PLAYER ))
return false;
if(parentBuffName == null || parentBuffName.equals(""))
return false;
if(childBuffName == null || childBuffName.equals(""))
return false;
if(eventName == null || eventName.equals(""))
return false;
if(collectionSlot == null || collectionSlot.equals(""))
return false;
if(!hasCompletedCollectionSlotPrereq(player, collectionSlot))
return false;
if(!buff.hasBuff(player, parentBuffName))
{
CustomerServiceLog("holidayEvent", "holiday.rewardEmpireDayPlayer: Player " + player + " no longer has required parent buff: "+parentBuffName+" so they cannot receive the counter buff: "+childBuffName+".");
return false;
}
CustomerServiceLog("holidayEvent", "holiday.rewardEmpireDayPlayer: Player " + player + " has passed validation.");
string eventType = buff.getStringGroupTwo(parentBuffName);
if(eventType == null || eventType.equals(""))
{
CustomerServiceLog("holidayEvent", "holiday.rewardEmpireDayPlayer: Player " + player + " tried to apply childbuff: "+childBuffName+" but it had no group2 data so it failed. exiting without giving player credit.");
return false;
}
//I DO NOT HAVE THE CHILD COUNTER BUFF
if(!buff.hasBuff(player, childBuffName))
{
if(!eventType.startsWith(BUFF_COMBATANT_GROUP) && !eventType.startsWith(BUFF_SF_GROUP))
{
CustomerServiceLog("holidayEvent", "holiday.rewardEmpireDayPlayer: Player " + player + " tried to apply childbuff: "+childBuffName+" but the group2 is invalid. exiting without giving player credit.");
return false;
}
//THIS SECTION GIVES THE PLAYER A MESSAGE BASED ON FACTION AND IF THE EVENT
//IS SF OR JUST COMBATANT
if(playerFaction == IMPERIAL_PLAYER)
{
if(eventType.startsWith(BUFF_COMBATANT_GROUP))
{
if(!getEventTokens(player, TOKEN_IMPERIAL_EMPIRE_DAY, TOKEN_AMOUNT_COMBATANT))
{
//CUSTOMER SVC LOG NEEDED
}
if(factions.isImperial(player) || factions.isRebel(player))
{
pvpModifyCurrentGcwPoints(player, GCW_AMOUNT_COMBATANT);
sendSystemMessage(player, SID_GCW_POINTS);
}
}
else if(eventType.startsWith(BUFF_SF_GROUP))
{
if(!factions.isDeclared(player))
{
sendSystemMessage(player, SID_NOT_SF);
return false;
}
if(!getEventTokens(player, TOKEN_IMPERIAL_EMPIRE_DAY, TOKEN_AMOUNT_SF))
{
//CUSTOMER SVC LOG NEEDED
}
pvpModifyCurrentGcwPoints(player, GCW_AMOUNT_SF);
sendSystemMessage(player, SID_GCW_POINTS);
}
buff.applyBuff(player, childBuffName);
}
else if(playerFaction == REBEL_PLAYER)
{
if(eventType.startsWith(BUFF_COMBATANT_GROUP))
{
if(!getEventTokens(player, TOKEN_REBEL_EMPIRE_DAY, TOKEN_AMOUNT_COMBATANT))
{
//CUSTOMER SVC LOG NEEDED
}
if(factions.isImperial(player) || factions.isRebel(player))
{
pvpModifyCurrentGcwPoints(player, GCW_AMOUNT_COMBATANT);
sendSystemMessage(player, SID_GCW_POINTS);
}
}
else if(eventType.startsWith(BUFF_SF_GROUP))
{
if(!factions.isDeclared(player))
{
sendSystemMessage(player, SID_NOT_SF);
return false;
}
if(!getEventTokens(player, TOKEN_REBEL_EMPIRE_DAY, TOKEN_AMOUNT_SF))
{
//CUSTOMER SVC LOG NEEDED
}
pvpModifyCurrentGcwPoints(player, GCW_AMOUNT_SF);
sendSystemMessage(player, SID_GCW_POINTS);
}
buff.applyBuff(player, childBuffName);
}
play2dNonLoopingSound(player, groundquests.MUSIC_QUEST_COMPLETED);
CustomerServiceLog("holidayEvent", "holiday.rewardEmpireDayPlayer: Player " + player + " no longer has required parent buff: "+parentBuffName+" so they cannot receive the counter buff: "+childBuffName+".");
}
//I HAVE THE CHILD COUNTER BUFF AND I NEED IT INCREMENTED
else
{
if(eventType.startsWith(BUFF_COMBATANT_GROUP))
{
string tokenReward = TOKEN_REBEL_EMPIRE_DAY;
if(playerFaction == IMPERIAL_PLAYER)
{
tokenReward = TOKEN_IMPERIAL_EMPIRE_DAY;
}
if(!getEventTokens(player, tokenReward, TOKEN_AMOUNT_COMBATANT))
{
//CUSTOMER SVC LOG NEEDED
}
if(factions.isImperial(player) || factions.isRebel(player))
{
pvpModifyCurrentGcwPoints(player, GCW_AMOUNT_COMBATANT);
sendSystemMessage(player, SID_GCW_POINTS);
}
}
else if(eventType.startsWith(BUFF_SF_GROUP))
{
if(!factions.isDeclared(player))
{
/*
buff.removeBuff(player, childBuffName);
buff.removeBuff(player, parentBuffName);
*/
sendSystemMessage(player, SID_NOT_SF);
return false;
}
string tokenReward = TOKEN_REBEL_EMPIRE_DAY;
if(playerFaction == IMPERIAL_PLAYER)
{
tokenReward = TOKEN_IMPERIAL_EMPIRE_DAY;
}
if(!getEventTokens(player, tokenReward, TOKEN_AMOUNT_SF))
{
//CUSTOMER SVC LOG NEEDED
}
pvpModifyCurrentGcwPoints(player, GCW_AMOUNT_SF);
sendSystemMessage(player, SID_GCW_POINTS);
}
play2dNonLoopingSound(player, groundquests.MUSIC_QUEST_INCREMENT_COUNTER);
buff.applyBuff(player, childBuffName);
}
return true;
}
boolean setEventLockOutTimeStamp(obj_id player, string eventLockOut)
{
if(!isValidId(player) || !exists(player))
return false;
if(eventLockOut == null || eventLockOut.equals(""))
return false;
if(hasObjVar(player, eventLockOut))
return false;
//If player doesn't have todays timestamp on, we're setting it.
int now = getCalendarTime();
int secondsUntil = getEmpireDayLockoutDelay();
int then = now + secondsUntil;
CustomerServiceLog("holidayEvent", "holiday.setEventLockOutTimeStamp: Setting lockout for player: "+player+" to expire on: "+then);
setObjVar(player, eventLockOut, then);
return true;
}
//Checking if it's a new day for event
boolean checkEventLockOutRemoval(obj_id player, string eventLockTimer, string eventLockFlag)
{
if(!isValidId(player) || !exists(player))
return false;
if(eventLockTimer == null || eventLockTimer.length() <= 0)
return false;
if(eventLockFlag == null || eventLockFlag.length() <= 0)
return false;
if(!hasObjVar(player, eventLockTimer) && !hasObjVar(player, eventLockFlag))
return true;
if(!hasObjVar(player, eventLockTimer) && hasObjVar(player, eventLockFlag))
{
CustomerServiceLog("holidayEvent", "holiday.checkEventLockOutRemoval: Player: "+player+" had lockout flag: "+eventLockFlag+" but not timer: "+eventLockTimer+". Removing flag.");
removeObjVar(player, eventLockFlag);
return true;
}
int now = getCalendarTime();
int then = getIntObjVar(player, eventLockTimer);
if(then <= 0)
{
CustomerServiceLog("holidayEvent", "holiday.checkEventLockOutRemoval: Player: "+player+" had invalid lockout timer: "+eventLockTimer+" for flag: "+eventLockFlag+". POSSIBLE EXPLOIT. Removing both objvars.");
removeObjVar(player, eventLockTimer);
removeObjVar(player, eventLockFlag);
removeObjVar(player, PLAYER_EMPIRE_DAY_SCORE);
removeObjVar(player, EMPIRE_DAY_BUFF_TRACKER);
return true;
}
if(now > then)
{
CustomerServiceLog("holidayEvent", "holiday.checkEventLockOutRemoval: Player: "+player+" has lockout timer that has expired: "+eventLockTimer+" for flag: "+eventLockFlag+". Removing both objvars to allow participation in event.");
removeObjVar(player, eventLockTimer);
removeObjVar(player, eventLockFlag);
removeObjVar(player, PLAYER_EMPIRE_DAY_SCORE);
removeObjVar(player, EMPIRE_DAY_BUFF_TRACKER);
return true;
}
return false;
}
//Checking if it's a new day for event
string getTimeRemainingBeforeLockoutRemoved(obj_id player, string eventLockOut)
{
if(!isValidId(player) || !exists(player))
return null;
if(eventLockOut == null || eventLockOut.equals(""))
return null;
if(!hasObjVar(player, eventLockOut))
return null;
int now = getCalendarTime();
int then = getIntObjVar(player, eventLockOut);
if(then <= 0)
{
//TO DO CUSTOMER SERVICE LOG
return null;
}
if(now > then)
return "can start another task now";
int timeLeft = (then - now);
return "you have "+utils.formatTimeVerbose(timeLeft)+" left before you are available for that task";
}
boolean getEventTokens(obj_id player, string tokenStaticItem, int amount)
{
if(!isValidId(player) || !exists(player))
return false;
if(tokenStaticItem == null || tokenStaticItem.equals(""))
return false;
if(amount <= 0)
return false;
obj_id pInv = utils.getInventoryContainer(player);
if(!isValidId(pInv) || !exists(pInv))
return false;
if(!isValidId(static_item.createNewItemFunction(tokenStaticItem, pInv, amount)))
{
//CUSTOMER SVC LOG
return false;
}
if(!hasObjVar(player, PLAYER_EMPIRE_DAY_SCORE))
{
setObjVar(player, PLAYER_EMPIRE_DAY_SCORE, getIntObjVar(player, PLAYER_EMPIRE_DAY_SCORE) + amount);
CustomerServiceLog("holidayEvent", "holiday.getEventTokens Player: "+player+" received their very first event points of "+amount+". Now the player has a score of: "+getIntObjVar(player, PLAYER_EMPIRE_DAY_SCORE));
}
else
{
setObjVar(player, PLAYER_EMPIRE_DAY_SCORE, getIntObjVar(player, PLAYER_EMPIRE_DAY_SCORE) + amount);
CustomerServiceLog("holidayEvent", "holiday.getEventTokens Player: "+player+" received "+amount+" points and now has a score of: "+getIntObjVar(player, PLAYER_EMPIRE_DAY_SCORE));
}
if(amount == 1)
{
sendSystemMessage(player, SID_TOKEN_REWARDED);
}
else
{
sendSystemMessage(player, SID_TOKENS_REWARDED);
}
return true;
}
int getEmpireDayLockoutDelay()
{
// returns the number of seconds until the next hour:minute:second of the day GMT calendar date/time
return secondsUntilNextDailyTime(DAILY_TIME, 0, 0);
//return 3600; //this is an hour lockout for testing.
}
//Constructs the SUI with one large string
boolean createEventLeaderBoardUI(obj_id player, string title, string combinedString)
{
if(!isValidId(player) || !isValidId(player))
return false;
if(title == null || title.length() <= 0)
return false;
if(combinedString == null || combinedString.length() <= 0)
return false;
dictionary params = new dictionary();
params.put("player", player);
closeOldWindow(player);
int pid = createSUIPage("/Script.messageBox", player, player);
setSUIAssociatedLocation(pid, player);
setSUIMaxRangeToObject(pid, 8);
params.put("callingPid", pid);
sui.setPid(player, pid, LEADERSUI_PID_NAME);
setSUIProperty(pid, "Prompt.lblPrompt", "LocalText", combinedString);
setSUIProperty(pid, "bg.caption.lblTitle", "Text", title);
setSUIProperty(pid, "Prompt.lblPrompt", "Editable", "false");
setSUIProperty(pid, "Prompt.lblPrompt", "GetsInput", "true");
setSUIProperty(pid, "btnCancel", "Visible", "false");
setSUIProperty(pid, "btnRevert", "Visible", "false");
setSUIProperty(pid, "btnOk", sui.PROP_TEXT, "Close");
//If tester hits ok button renamed to Create File, send to message handler
subscribeToSUIEvent(pid, sui_event_type.SET_onClosedOk, "%button0%", "closeLeaderSui");
subscribeToSUIEvent(pid, sui_event_type.SET_onClosedCancel, "%button0%", "closeLeaderSui");
showSUIPage(pid);
flushSUIPage(pid);
return true;
}
void closeOldWindow(obj_id player)
{
int pid = sui.getPid(player, LEADERSUI_PID_NAME);
if(pid > -1)
{
forceCloseSUIPage(pid);
sui.removePid(player, LEADERSUI_PID_NAME);
}
}
string getEventHighScores(obj_id planet, string scoreObjVar, boolean faction)
{
if(!isValidId(planet) || !exists(planet))
return null;
if(scoreObjVar == null || scoreObjVar.length() <= 0)
return null;
string data = "";
if(!faction)
{
for(int i = 1; i <= MAX_NUMBER_OF_PLANET_HIGH_SCORES; i++)
{
string name = getStringObjVar(planet, scoreObjVar+".slot_" + i + holiday.PLANET_VAR_PLAYER_NAME);
int score = getIntObjVar(planet, scoreObjVar+".slot_" + i + holiday.PLANET_VAR_PLAYER_SCORE);
data += "\\^005" + i + ". \\%015" + name + " \\%015" + score + "\n";
}
}
else
{
data += sui.colorBlue()+"IMPERIAL\n"+sui.colorWhite();
for(int i = 1; i <= MAX_NUMBER_OF_PLANET_HIGH_SCORES; i++)
{
string name = getStringObjVar(planet, scoreObjVar+".slot_" + i + holiday.PLANET_VAR_PLAYER_FACTION_IMP + holiday.PLANET_VAR_PLAYER_NAME);
int score = getIntObjVar(planet, scoreObjVar+".slot_" + i + holiday.PLANET_VAR_PLAYER_FACTION_IMP + holiday.PLANET_VAR_PLAYER_SCORE);
data += i + "\t" + name + "\t - " + score + "\n";
CustomerServiceLog("holidayEventScore", "getEventHighScores: name: "+name+" score: "+score);
}
data += sui.colorRed()+"\nREBEL\n"+sui.colorWhite();
for(int i = 1; i <= MAX_NUMBER_OF_PLANET_HIGH_SCORES; i++)
{
string name = getStringObjVar(planet, scoreObjVar+".slot_" + i + holiday.PLANET_VAR_PLAYER_FACTION_REB + holiday.PLANET_VAR_PLAYER_NAME);
int score = getIntObjVar(planet, scoreObjVar+".slot_" + i + holiday.PLANET_VAR_PLAYER_FACTION_REB + holiday.PLANET_VAR_PLAYER_SCORE);
data += i + "\t" + name + "\t - " + score + "\n";
}
}
return data;
}
boolean setEmpireDayLeaderScores(obj_id planet, obj_id player, string scoreObjVar, int newScore, string playerName, int faction)
{
CustomerServiceLog("holidayEventScore", "setEmpireDayLeaderScores: scoreObjVar: "+scoreObjVar+" score: "+newScore);
if(!isValidId(planet) || !exists(planet))
return false;
if(newScore <= 0)
return false;
if(scoreObjVar == null || scoreObjVar.length() <= 0)
return false;
if(playerName == null || playerName.length() <= 0)
return false;
CustomerServiceLog("holidayEventScore", "setEmpireDayLeaderScores: passed validation");
string postAppendName = "";
string postAppendScore = "";
if(faction == holiday.IMPERIAL_PLAYER)
{
CustomerServiceLog("holidayEventScore", "setEmpireDayLeaderScores: Is Imp Player");
postAppendName = holiday.PLANET_VAR_PLAYER_FACTION_IMP + holiday.PLANET_VAR_PLAYER_NAME;
postAppendScore = holiday.PLANET_VAR_PLAYER_FACTION_IMP + holiday.PLANET_VAR_PLAYER_SCORE;
}
else if(faction == holiday.REBEL_PLAYER)
{
CustomerServiceLog("holidayEventScore", "setEmpireDayLeaderScores: Is Reb Player");
postAppendName = holiday.PLANET_VAR_PLAYER_FACTION_REB + holiday.PLANET_VAR_PLAYER_NAME;
postAppendScore = holiday.PLANET_VAR_PLAYER_FACTION_REB + holiday.PLANET_VAR_PLAYER_SCORE;
}
if(postAppendName == null || postAppendName.length() <= 0)
return false;
if(postAppendScore == null || postAppendScore.length() <= 0)
return false;
//Player doesn't have a score higher than the last score listed.
if(newScore <= getIntObjVar(planet, scoreObjVar + ".slot_5" + postAppendScore))
{
CustomerServiceLog("holidayEventScore", "setEmpireDayLeaderScores: Player doesn't have a high enough score");
CustomerServiceLog("holidayEventScore", "setEmpireDayLeaderScores: Lowest score: " +getIntObjVar(planet, scoreObjVar + ".slot_5" + postAppendScore));
return true;
}
//We check for the players name and see if they have the same score they did previously
for(int i = 1; i <= MAX_NUMBER_OF_PLANET_HIGH_SCORES; i++)
{
string name = getStringObjVar(planet, scoreObjVar+".slot_" + i + postAppendName);
if(name == null || name.length() <= 0)
continue;
if(!playerName.equals(name))
{
CustomerServiceLog("holidayEventScore", "setEmpireDayLeaderScores: NO match. Name: "+name+ " and player name: "+playerName );
CustomerServiceLog("holidayEventScore", "Name length: "+name.length()+ " and player name: "+playerName.length());
continue;
}
CustomerServiceLog("holidayEventScore", "setEmpireDayLeaderScores: found name match");
int score = getIntObjVar(planet, scoreObjVar+".slot_" + i + postAppendScore);
if(newScore == score)
{
CustomerServiceLog("holidayEventScore", "setEmpireDayLeaderScores: Player already has a score on leader board.");
return true;
}
}
int newHsSlot = -1;
// insert the new score in the appropriate high slot
for(int i = MAX_NUMBER_OF_PLANET_HIGH_SCORES - 1; i >= 1; i--)
{
int existingScore = 0;
if(faction == holiday.IMPERIAL_PLAYER)
{
existingScore = getIntObjVar(planet, scoreObjVar + ".slot_" + i + holiday.PLANET_VAR_PLAYER_FACTION_IMP + holiday.PLANET_VAR_PLAYER_SCORE);
}
else
{
existingScore = getIntObjVar(planet, scoreObjVar + ".slot_" + i + holiday.PLANET_VAR_PLAYER_FACTION_REB + holiday.PLANET_VAR_PLAYER_SCORE);
}
if(newScore >= existingScore)
{
CustomerServiceLog("holidayEventScore", newScore+ " is greater than "+existingScore);
newHsSlot = i;
}
else
break;
}
//Didn't beat a score
if(newHsSlot < 0)
return true;
// newHsSlot is where the newscore should be inserted
// shift all existing slots at newHsSlot downward to
// make room for the new high score
for(int i = MAX_NUMBER_OF_PLANET_HIGH_SCORES; i >= newHsSlot; i--)
{
if(i < MAX_NUMBER_OF_PLANET_HIGH_SCORES && i > 0)
{
string moveName = getStringObjVar(planet, scoreObjVar + ".slot_" + i + postAppendName);
int moveScore = getIntObjVar(planet, scoreObjVar + ".slot_" + i + postAppendScore);
setObjVar(planet, scoreObjVar + ".slot_" + (i+1) + postAppendName, moveName);
setObjVar(planet, scoreObjVar + ".slot_" + (i+1) + postAppendScore, moveScore);
}
}
setObjVar(planet, scoreObjVar + ".slot_" + newHsSlot + postAppendScore, newScore);
setObjVar(planet, scoreObjVar + ".slot_" + newHsSlot + postAppendName, playerName);
return true;
}
boolean removeAllCompletedQuestsForDeathTroopers(obj_id player)
{
//-----------------------------------------------
//--------------------------------ALL NEUTRAL
//-----------------------------------------------
if(groundquests.isQuestActiveOrComplete(player, "outbreak_live_conversion_neutral"))
groundquests.clearQuest(player, "outbreak_live_conversion_neutral");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_switch_to_neutral"))
groundquests.clearQuest(player, "outbreak_switch_to_neutral");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_01_neutral"))
groundquests.clearQuest(player, "outbreak_quest_01_neutral");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_01_b_neutral"))
groundquests.clearQuest(player, "outbreak_quest_01_b_neutral");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_02_neutral"))
groundquests.clearQuest(player, "outbreak_quest_02_neutral");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_neutral_01"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_neutral_01");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_neutral_02"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_neutral_02");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_neutral_03"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_neutral_03");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_neutral_04"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_neutral_04");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_neutral_05"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_neutral_05");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_facility_02_neutral"))
groundquests.clearQuest(player, "outbreak_quest_facility_02_neutral");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_facility_05_neutral"))
groundquests.clearQuest(player, "outbreak_quest_facility_05_neutral");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_final_neutral"))
groundquests.clearQuest(player, "outbreak_quest_final_neutral");
//-----------------------------------------------
//--------------------------------ALL REBEL
//-----------------------------------------------
if(groundquests.isQuestActiveOrComplete(player, "outbreak_live_conversion_rebel"))
groundquests.clearQuest(player, "outbreak_live_conversion_rebel");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_switch_to_rebel"))
groundquests.clearQuest(player, "outbreak_switch_to_rebel");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_01_rebel"))
groundquests.clearQuest(player, "outbreak_quest_01_rebel");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_01_b_rebel"))
groundquests.clearQuest(player, "outbreak_quest_01_b_rebel");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_02_rebel"))
groundquests.clearQuest(player, "outbreak_quest_02_rebel");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_rebel_01"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_rebel_01");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_rebel_02"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_rebel_02");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_rebel_03"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_rebel_03");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_rebel_04"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_rebel_04");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_rebel_05"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_rebel_05");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_facility_02_rebel"))
groundquests.clearQuest(player, "outbreak_quest_facility_02_rebel");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_facility_05_rebel"))
groundquests.clearQuest(player, "outbreak_quest_facility_05_rebel");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_final_rebel"))
groundquests.clearQuest(player, "outbreak_quest_final_rebel");
//-----------------------------------------------
//--------------------------------ALL IMPERIAL
//-----------------------------------------------
if(groundquests.isQuestActiveOrComplete(player, "outbreak_live_conversion_imperial"))
groundquests.clearQuest(player, "outbreak_live_conversion_imperial");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_switch_to_imperial"))
groundquests.clearQuest(player, "outbreak_switch_to_imperial");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_01_imperial"))
groundquests.clearQuest(player, "outbreak_quest_01_imperial");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_01_b_imperial"))
groundquests.clearQuest(player, "outbreak_quest_01_b_imperial");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_02_imperial"))
groundquests.clearQuest(player, "outbreak_quest_02_imperial");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_imperial_01"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_imperial_01");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_imperial_02"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_imperial_02");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_imperial_03"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_imperial_03");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_imperial_04"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_imperial_04");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_administrative_building_imperial_05"))
groundquests.clearQuest(player, "outbreak_quest_administrative_building_imperial_05");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_facility_02_imperial"))
groundquests.clearQuest(player, "outbreak_quest_facility_02_imperial");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_facility_05_imperial"))
groundquests.clearQuest(player, "outbreak_quest_facility_05_imperial");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_final_imperial"))
groundquests.clearQuest(player, "outbreak_quest_final_imperial");
//-----------------------------------------------
//--------------------------------ALL NON-FACTIONAL
//-----------------------------------------------
//RESCUE QUESTS
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_01"))
groundquests.clearQuest(player, "outbreak_quest_rescue_01");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_01b"))
groundquests.clearQuest(player, "outbreak_quest_rescue_01b");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_01c"))
groundquests.clearQuest(player, "outbreak_quest_rescue_01c");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_01d"))
groundquests.clearQuest(player, "outbreak_quest_rescue_01d");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_02"))
groundquests.clearQuest(player, "outbreak_quest_rescue_02");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_03"))
groundquests.clearQuest(player, "outbreak_quest_rescue_03");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_04"))
groundquests.clearQuest(player, "outbreak_quest_rescue_04");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_05"))
groundquests.clearQuest(player, "outbreak_quest_rescue_05");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_06"))
groundquests.clearQuest(player, "outbreak_quest_rescue_06");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_07"))
groundquests.clearQuest(player, "outbreak_quest_rescue_07");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_08"))
groundquests.clearQuest(player, "outbreak_quest_rescue_08");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_09"))
groundquests.clearQuest(player, "outbreak_quest_rescue_09");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_010"))
groundquests.clearQuest(player, "outbreak_quest_rescue_010");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_011"))
groundquests.clearQuest(player, "outbreak_quest_rescue_011");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_012"))
groundquests.clearQuest(player, "outbreak_quest_rescue_012");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_013"))
groundquests.clearQuest(player, "outbreak_quest_rescue_013");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_014"))
groundquests.clearQuest(player, "outbreak_quest_rescue_014");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_015"))
groundquests.clearQuest(player, "outbreak_quest_rescue_015");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_rescue_016"))
groundquests.clearQuest(player, "outbreak_quest_rescue_016");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_shuttle_parts"))
groundquests.clearQuest(player, "outbreak_quest_shuttle_parts");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_facility_01"))
groundquests.clearQuest(player, "outbreak_quest_facility_01");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_facility_02"))
groundquests.clearQuest(player, "outbreak_quest_facility_02");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_facility_03"))
groundquests.clearQuest(player, "outbreak_quest_facility_03");
if(groundquests.isQuestActiveOrComplete(player, "outbreak_quest_facility_04"))
groundquests.clearQuest(player, "outbreak_quest_facility_04");
return true;
}