mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
659 lines
18 KiB
Plaintext
659 lines
18 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// nym_arena_referee.script
|
|
// Copyright 2004, Sony Online Entertainment
|
|
// All Rights Reserved.
|
|
//
|
|
// Created with SwgConversationEditor 1.37 - DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
//
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Library Includes
|
|
// ======================================================================
|
|
|
|
include library.ai_lib;
|
|
include library.chat;
|
|
include library.conversation;
|
|
include library.groundquests;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/nym_arena_referee";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean nym_arena_referee_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean nym_arena_referee_condition_hasFirstArenaTask (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
return groundquests.isTaskActive(player, "u16_nym_themepark_nym_arena", "hasFirstArenaFight");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean nym_arena_referee_condition_hasSecondArenaTask (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
return groundquests.isTaskActive(player, "u16_nym_themepark_nym_arena", "hasSecondArenaFight");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean nym_arena_referee_condition_hasThirdArenaTask (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
return groundquests.isTaskActive(player, "u16_nym_themepark_nym_arena", "hasThirdArenaFight");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean nym_arena_referee_condition_hasFourthArenaTask (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
return groundquests.isTaskActive(player, "u16_nym_themepark_nym_arena", "hasFourthArenaFight");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean nym_arena_referee_condition_hasFifthAreanaTask (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
return groundquests.isTaskActive(player, "u16_nym_themepark_nym_arena", "hasFifthArenaFight");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean nym_arena_referee_condition_hasCompletedArenaTask (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
return groundquests.isTaskActive(player, "u16_nym_themepark_nym_arena", "hasCompletedArenaForNym")
|
|
|| groundquests.hasCompletedQuest(player, "u16_nym_themepark_nym_arena");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean nym_arena_referee_condition_wave_event_active (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc, player);
|
|
int wave = utils.getIntScriptVar(npc, "waveEventCurrentWave");
|
|
return wave > 0;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void nym_arena_referee_action_spawnOpponent (obj_id player, obj_id npc)
|
|
{
|
|
dictionary webster = new dictionary();
|
|
webster.put("player", player);
|
|
messageTo(npc, "waveEventControllerNPCStart", webster, 0, false);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int nym_arena_referee_handleBranch3 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Ready for your final opponent, %TU?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes.
|
|
if (response == "s_34")
|
|
{
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "salute2");
|
|
|
|
nym_arena_referee_action_spawnOpponent (player, npc);
|
|
|
|
//-- NPC: Good luck!
|
|
string_id message = new string_id (c_stringFile, "s_36");
|
|
utils.removeScriptVar (player, "conversation.nym_arena_referee.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int nym_arena_referee_handleBranch5 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Ready for your fourth opponent, %TU?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes.
|
|
if (response == "s_32")
|
|
{
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "clap_rousing");
|
|
|
|
nym_arena_referee_action_spawnOpponent (player, npc);
|
|
|
|
//-- NPC: Good luck!
|
|
string_id message = new string_id (c_stringFile, "s_33");
|
|
utils.removeScriptVar (player, "conversation.nym_arena_referee.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int nym_arena_referee_handleBranch7 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Ready for your third opponent, %TU?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes.
|
|
if (response == "s_30")
|
|
{
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "bow3");
|
|
|
|
nym_arena_referee_action_spawnOpponent (player, npc);
|
|
|
|
//-- NPC: Good luck!
|
|
string_id message = new string_id (c_stringFile, "s_31");
|
|
utils.removeScriptVar (player, "conversation.nym_arena_referee.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int nym_arena_referee_handleBranch9 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Ready for your second opponent, %TU?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes.
|
|
if (response == "s_28")
|
|
{
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "applause_polite");
|
|
|
|
nym_arena_referee_action_spawnOpponent (player, npc);
|
|
|
|
//-- NPC: Good luck!
|
|
string_id message = new string_id (c_stringFile, "s_29");
|
|
utils.removeScriptVar (player, "conversation.nym_arena_referee.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int nym_arena_referee_handleBranch11 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: You must be %TU. Are you ready for your first fight?
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes.
|
|
if (response == "s_22")
|
|
{
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition__defaultCondition (player, npc))
|
|
{
|
|
doAnimationAction (npc, "celebrate1");
|
|
|
|
nym_arena_referee_action_spawnOpponent (player, npc);
|
|
|
|
//-- NPC: Good luck!
|
|
string_id message = new string_id (c_stringFile, "s_23");
|
|
utils.removeScriptVar (player, "conversation.nym_arena_referee.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isTangible (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.nym_arena_referee");
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuRequest (obj_id player, menu_info menuInfo)
|
|
{
|
|
int menu = menuInfo.addRootMenu (menu_info_types.CONVERSE_START, null);
|
|
menu_info_data menuInfoData = menuInfo.getMenuItemById (menu);
|
|
menuInfoData.setServerNotify (false);
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnIncapacitated (obj_id killer)
|
|
{
|
|
clearCondition (self, CONDITION_CONVERSABLE);
|
|
detachScript (self, "conversation.nym_arena_referee");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Triggers
|
|
// ======================================================================
|
|
|
|
//-- This function should move to base_class.java
|
|
boolean npcStartConversation(obj_id player, obj_id npc, string convoName, string_id greetingId, prose_package greetingProse, string_id[] responses)
|
|
{
|
|
Object[] objects = new Object[responses.length];
|
|
System.arraycopy(responses, 0, objects, 0, responses.length);
|
|
return npcStartConversation(player, npc, convoName, greetingId, greetingProse, objects);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
trigger OnStartNpcConversation (obj_id player)
|
|
{
|
|
obj_id npc = self;
|
|
|
|
if (ai_lib.isInCombat (npc) || ai_lib.isInCombat (player))
|
|
return SCRIPT_OVERRIDE;
|
|
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition_wave_event_active (player, npc))
|
|
{
|
|
//-- NPC: The Arena is busy at the moment. Come back later.
|
|
string_id message = new string_id (c_stringFile, "s_20");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition_hasCompletedArenaTask (player, npc))
|
|
{
|
|
//-- NPC: Great show, %TU. That is all I have for you.
|
|
string_id message = new string_id (c_stringFile, "s_37");
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
chat.chat (npc, player, null, null, pp);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition_hasFifthAreanaTask (player, npc))
|
|
{
|
|
//-- NPC: Ready for your final opponent, %TU?
|
|
string_id message = new string_id (c_stringFile, "s_24");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes.
|
|
boolean hasResponse0 = false;
|
|
if (nym_arena_referee_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses [] = new string_id [numberOfResponses];
|
|
|
|
if (hasResponse0)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_34");
|
|
|
|
utils.setScriptVar (player, "conversation.nym_arena_referee.branchId", 3);
|
|
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
npcStartConversation (player, npc, "nym_arena_referee", null, pp, responses);
|
|
}
|
|
else
|
|
{
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
chat.chat (npc, player, null, null, pp);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition_hasFourthArenaTask (player, npc))
|
|
{
|
|
//-- NPC: Ready for your fourth opponent, %TU?
|
|
string_id message = new string_id (c_stringFile, "s_25");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes.
|
|
boolean hasResponse0 = false;
|
|
if (nym_arena_referee_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses [] = new string_id [numberOfResponses];
|
|
|
|
if (hasResponse0)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_32");
|
|
|
|
utils.setScriptVar (player, "conversation.nym_arena_referee.branchId", 5);
|
|
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
npcStartConversation (player, npc, "nym_arena_referee", null, pp, responses);
|
|
}
|
|
else
|
|
{
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
chat.chat (npc, player, null, null, pp);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition_hasThirdArenaTask (player, npc))
|
|
{
|
|
//-- NPC: Ready for your third opponent, %TU?
|
|
string_id message = new string_id (c_stringFile, "s_26");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes.
|
|
boolean hasResponse0 = false;
|
|
if (nym_arena_referee_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses [] = new string_id [numberOfResponses];
|
|
|
|
if (hasResponse0)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_30");
|
|
|
|
utils.setScriptVar (player, "conversation.nym_arena_referee.branchId", 7);
|
|
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
npcStartConversation (player, npc, "nym_arena_referee", null, pp, responses);
|
|
}
|
|
else
|
|
{
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
chat.chat (npc, player, null, null, pp);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition_hasSecondArenaTask (player, npc))
|
|
{
|
|
//-- NPC: Ready for your second opponent, %TU?
|
|
string_id message = new string_id (c_stringFile, "s_27");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes.
|
|
boolean hasResponse0 = false;
|
|
if (nym_arena_referee_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses [] = new string_id [numberOfResponses];
|
|
|
|
if (hasResponse0)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_28");
|
|
|
|
utils.setScriptVar (player, "conversation.nym_arena_referee.branchId", 9);
|
|
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
npcStartConversation (player, npc, "nym_arena_referee", null, pp, responses);
|
|
}
|
|
else
|
|
{
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
chat.chat (npc, player, null, null, pp);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition_hasFirstArenaTask (player, npc))
|
|
{
|
|
//-- NPC: You must be %TU. Are you ready for your first fight?
|
|
string_id message = new string_id (c_stringFile, "s_21");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes.
|
|
boolean hasResponse0 = false;
|
|
if (nym_arena_referee_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses [] = new string_id [numberOfResponses];
|
|
|
|
if (hasResponse0)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_22");
|
|
|
|
utils.setScriptVar (player, "conversation.nym_arena_referee.branchId", 11);
|
|
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
npcStartConversation (player, npc, "nym_arena_referee", null, pp, responses);
|
|
}
|
|
else
|
|
{
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
chat.chat (npc, player, null, null, pp);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (nym_arena_referee_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: There is no %TU on my list of arena fighters. You're out of luck.
|
|
string_id message = new string_id (c_stringFile, "s_100");
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
|
|
chat.chat (npc, player, null, null, pp);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (npc, "Error: All conditions for OnStartNpcConversation were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
trigger OnNpcConversationResponse (string conversationId, obj_id player, string_id response)
|
|
{
|
|
if (conversationId != "nym_arena_referee")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.nym_arena_referee.branchId");
|
|
|
|
if (branchId == 3 && nym_arena_referee_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 5 && nym_arena_referee_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 7 && nym_arena_referee_handleBranch7 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 9 && nym_arena_referee_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 11 && nym_arena_referee_handleBranch11 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.nym_arena_referee.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|