mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
129 lines
3.4 KiB
Plaintext
129 lines
3.4 KiB
Plaintext
// ---------------------------------------------------------------------
|
|
|
|
include library.groundquests;
|
|
include library.group;
|
|
include library.instance;
|
|
include library.stealth;
|
|
include library.sui;
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
const int COUNTDOWN_TIME = 5;
|
|
|
|
const string QUEST_NAME = "found_ig88_encounter";
|
|
const string QUEST_TASK_NAME = "ig88_enter_compound";
|
|
const string QUEST_SIGNAL = "ig88_compound_enter_signal";
|
|
const string INSTANCE_NAME = "heroic_ig88";
|
|
|
|
const string_id SCANNER_TEXT = new string_id("spam","ig88_use_scanner");
|
|
|
|
trigger OnObjectMenuRequest (obj_id player, menu_info menuInfo)
|
|
{
|
|
if (isDead(player) || isIncapacitated(player))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
int menu = menu = menuInfo.addRootMenu (menu_info_types.ITEM_USE, SCANNER_TEXT);
|
|
|
|
menu_info_data menuInfoData = menuInfo.getMenuItemById (menu);
|
|
|
|
if ( menuInfoData != null )
|
|
{
|
|
menuInfoData.setServerNotify(true);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
if (isDead(player) || isIncapacitated(player))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if( item == menu_info_types.ITEM_USE && (groundquests.isQuestActiveOrComplete(player, QUEST_NAME) || instance.isFlaggedForInstance(player, "heroic_ig88")))
|
|
{
|
|
string_id menuStringId = new string_id("spam","ig88_use_scanner");
|
|
|
|
string handler = "handleCountdownTimer";
|
|
int startTime = 0;
|
|
int range = 3;
|
|
|
|
int flags = 0;
|
|
//flags |= sui.CD_EVENT_LOCOMOTION;
|
|
flags |= sui.CD_EVENT_INCAPACITATE;
|
|
flags |= sui.CD_EVENT_DAMAGED;
|
|
|
|
stealth.testInvisNonCombatAction(player, self);
|
|
|
|
int countdownSui = sui.smartCountdownTimerSUI(self, player, "quest_countdown_timer", menuStringId, startTime, COUNTDOWN_TIME, handler, range, flags);
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessage(player, new string_id("nexus", "retina_not_recognized"));
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler handleCountdownTimer()
|
|
{
|
|
int pid = params.getInt("id");
|
|
obj_id player = params.getObjId("player");
|
|
|
|
if( !isIdValid(player) )
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
int bp = sui.getIntButtonPressed(params);
|
|
|
|
// Cancel button is sent when player manually closes the countdown window,
|
|
// or when he/she moves out of range.
|
|
if(bp == sui.BP_CANCEL)
|
|
{
|
|
detachScript(player, sui.COUNTDOWNTIMER_PLAYER_SCRIPT);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
else if(bp == sui.BP_REVERT)
|
|
{
|
|
// Gets the reason why the timer was aborted
|
|
int event = params.getInt("event");
|
|
|
|
// You can handle the situation differently depending on the reason
|
|
if(event == sui.CD_EVENT_LOCOMOTION)
|
|
{
|
|
sendSystemMessage(player, new string_id("quest/groundquests", "countdown_interrupted_locomotion"));
|
|
}
|
|
else if(event == sui.CD_EVENT_INCAPACITATE)
|
|
{
|
|
sendSystemMessage(player, new string_id("quest/groundquests", "countdown_interrupted_incapacitated"));
|
|
}
|
|
else if(event == sui.CD_EVENT_DAMAGED)
|
|
{
|
|
sendSystemMessage(player, new string_id("quest/groundquests", "countdown_interrupted_damaged"));
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(!hasObjVar(player, sui.COUNTDOWNTIMER_SUI_VAR))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
int test_pid = getIntObjVar(player, sui.COUNTDOWNTIMER_SUI_VAR);
|
|
|
|
if(pid != test_pid)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
forceCloseSUIPage(pid);
|
|
|
|
detachScript(player, sui.COUNTDOWNTIMER_PLAYER_SCRIPT);
|
|
groundquests.sendSignal(player, QUEST_SIGNAL);
|
|
instance.requestInstanceMovement(player, INSTANCE_NAME);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|