mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
494 lines
15 KiB
Plaintext
494 lines
15 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// fs_experience_converter.script
|
|
//
|
|
//
|
|
//
|
|
// DO NOT EDIT THIS AUTO-GENERATED FILE. PLEASE USE THE CONVERATION EDITOR!
|
|
//
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Library Includes
|
|
// ======================================================================
|
|
|
|
include library.ai_lib;
|
|
include library.chat;
|
|
include library.fs_quests;
|
|
include library.utils;
|
|
include library.xp;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/fs_experience_converter";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean fs_experience_converter_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean fs_experience_converter_condition_canConvertXP (obj_id player, obj_id npc)
|
|
{
|
|
// Add in check for completion of the intro theatre
|
|
return fs_quests.isVillageEligible(player);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean fs_experience_converter_condition_isConvertEligible (obj_id player, obj_id npc)
|
|
{
|
|
return fs_quests.hasFreeUnlockBranches(player);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void fs_experience_converter_action_showSUICrafting (obj_id player, obj_id npc)
|
|
{
|
|
xp.displayForceSensitiveXP(player, "crafting");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void fs_experience_converter_action_showSUICombat (obj_id player, obj_id npc)
|
|
{
|
|
xp.displayForceSensitiveXP(player, "combat");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void fs_experience_converter_action_showSUISenses (obj_id player, obj_id npc)
|
|
{
|
|
xp.displayForceSensitiveXP(player, "senses");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void fs_experience_converter_action_showSUIReflexes (obj_id player, obj_id npc)
|
|
{
|
|
xp.displayForceSensitiveXP(player, "reflex");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void fs_experience_converter_action_closeConversionSUI (obj_id player, obj_id npc)
|
|
{
|
|
if (utils.hasScriptVar(player, "force_sensitive.sui_pid"))
|
|
{
|
|
forceCloseSUIPage(utils.getIntScriptVar(player, "force_sensitive.sui_pid"));
|
|
}
|
|
if (utils.hasScriptVar(player, fs_quests.SCRIPT_VAR_BRANCH_SELECT_SUI))
|
|
{
|
|
forceCloseSUIPage(utils.getIntScriptVar(player, fs_quests.SCRIPT_VAR_BRANCH_SELECT_SUI));
|
|
}
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void fs_experience_converter_action_showSUIUnlock (obj_id player, obj_id npc)
|
|
{
|
|
fs_quests.showBranchUnlockSUI(player);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
string fs_experience_converter_tokenTO_branchList (obj_id player, obj_id npc)
|
|
{
|
|
string branch_list = "\nNothing";
|
|
boolean has_branch = false;
|
|
for (int i = 0; i < 16; i++)
|
|
{
|
|
if (fs_quests.hasUnlockedBranch(player, i))
|
|
{
|
|
string branch = fs_quests.getBranchFromId(i);
|
|
string branch_name = localize(new string_id("quest/force_sensitive/utils", branch));
|
|
if (branch != null)
|
|
{
|
|
if (!has_branch)
|
|
{
|
|
branch_list = "\n" + branch_name;
|
|
has_branch = true;
|
|
}
|
|
else
|
|
branch_list += "\n" + branch_name;
|
|
}
|
|
}
|
|
}
|
|
return branch_list;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "npc.conversation.fs_experience_converter");
|
|
|
|
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, "npc.conversation.fs_experience_converter");
|
|
|
|
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)
|
|
{
|
|
if (ai_lib.isInCombat (self) || ai_lib.isInCombat (player))
|
|
return SCRIPT_OVERRIDE;
|
|
|
|
//-- [NOTE]
|
|
if (fs_experience_converter_condition_canConvertXP (player, self))
|
|
{
|
|
doAnimationAction (self, "beckon");
|
|
|
|
fs_experience_converter_action_closeConversionSUI (player, self);
|
|
|
|
//-- NPC: Welcome, friend! Come here and tell me what insight I may provide for you today?
|
|
string_id message = new string_id (c_stringFile, "s_962f82a6");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I wish to learn more about using the Force for crafting.
|
|
boolean hasResponse0 = false;
|
|
if (fs_experience_converter_condition__defaultCondition (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I wish to learn more about using the Force for combat.
|
|
boolean hasResponse1 = false;
|
|
if (fs_experience_converter_condition__defaultCondition (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
|
|
//-- PLAYER: I wish to learn more about using the Force to enchance my senses.
|
|
boolean hasResponse2 = false;
|
|
if (fs_experience_converter_condition__defaultCondition (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse2 = true;
|
|
}
|
|
|
|
//-- PLAYER: I wish to learn more about using the Force to enhance my reflexes.
|
|
boolean hasResponse3 = false;
|
|
if (fs_experience_converter_condition__defaultCondition (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse3 = true;
|
|
}
|
|
|
|
//-- PLAYER: I wish to learn new uses of the Force.
|
|
boolean hasResponse4 = false;
|
|
if (fs_experience_converter_condition_isConvertEligible (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse4 = true;
|
|
}
|
|
|
|
//-- PLAYER: What aspects of the Force am I ready to learn?
|
|
boolean hasResponse5 = false;
|
|
if (fs_experience_converter_condition__defaultCondition (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse5 = true;
|
|
}
|
|
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses [] = new string_id [numberOfResponses];
|
|
|
|
if (hasResponse0)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_73ab6ff4");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_76fa10e4");
|
|
|
|
if (hasResponse2)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_968c3ff6");
|
|
|
|
if (hasResponse3)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_2734c210");
|
|
|
|
if (hasResponse4)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_69a7c6ca");
|
|
|
|
if (hasResponse5)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_e4c01185");
|
|
|
|
setObjVar (player, "conversation.fs_experience_converter.branchId", 1);
|
|
|
|
npcStartConversation (player, self, "fs_experience_converter", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (self, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (!fs_experience_converter_condition_canConvertXP (player, self))
|
|
{
|
|
doAnimationAction (self, "sigh_deeply");
|
|
|
|
//-- NPC: I am sorry, stranger. Your mind is still too cloudy for me to help you. Remove your doubts with journey and mediation. Then return to me.
|
|
string_id message = new string_id (c_stringFile, "s_37fbfae6");
|
|
chat.chat (self, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnStartNpcConversation were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
trigger OnNpcConversationResponse (string conversationId, obj_id player, string_id response)
|
|
{
|
|
if (conversationId != "fs_experience_converter")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
int branchId = getIntObjVar (player, "conversation.fs_experience_converter.branchId");
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Welcome, friend! Come here and tell me what insight I may provide for you today?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I wish to learn more about using the Force for crafting.
|
|
if (branchId == 1 && response == "s_73ab6ff4")
|
|
{
|
|
//-- [NOTE]
|
|
if (fs_experience_converter_condition__defaultCondition (player, self))
|
|
{
|
|
fs_experience_converter_action_showSUICrafting (player, self);
|
|
|
|
//-- NPC: Allow me to help you understand your experiences...
|
|
string_id message = new string_id (c_stringFile, "s_7542cfea");
|
|
removeObjVar (player, "conversation.fs_experience_converter.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Welcome, friend! Come here and tell me what insight I may provide for you today?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Welcome, friend! Come here and tell me what insight I may provide for you today?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I wish to learn more about using the Force for combat.
|
|
if (branchId == 1 && response == "s_76fa10e4")
|
|
{
|
|
//-- [NOTE]
|
|
if (fs_experience_converter_condition__defaultCondition (player, self))
|
|
{
|
|
fs_experience_converter_action_showSUICombat (player, self);
|
|
|
|
//-- NPC: Allow me to help you understand your experiences...
|
|
string_id message = new string_id (c_stringFile, "s_7542cfea");
|
|
removeObjVar (player, "conversation.fs_experience_converter.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Welcome, friend! Come here and tell me what insight I may provide for you today?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Welcome, friend! Come here and tell me what insight I may provide for you today?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I wish to learn more about using the Force to enchance my senses.
|
|
if (branchId == 1 && response == "s_968c3ff6")
|
|
{
|
|
//-- [NOTE]
|
|
if (fs_experience_converter_condition__defaultCondition (player, self))
|
|
{
|
|
fs_experience_converter_action_showSUISenses (player, self);
|
|
|
|
//-- NPC: Allow me to help you understand your experiences...
|
|
string_id message = new string_id (c_stringFile, "s_7542cfea");
|
|
removeObjVar (player, "conversation.fs_experience_converter.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Welcome, friend! Come here and tell me what insight I may provide for you today?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Welcome, friend! Come here and tell me what insight I may provide for you today?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I wish to learn more about using the Force to enhance my reflexes.
|
|
if (branchId == 1 && response == "s_2734c210")
|
|
{
|
|
//-- [NOTE]
|
|
if (fs_experience_converter_condition__defaultCondition (player, self))
|
|
{
|
|
fs_experience_converter_action_showSUIReflexes (player, self);
|
|
|
|
//-- NPC: Allow me to help you understand your experiences...
|
|
string_id message = new string_id (c_stringFile, "s_7542cfea");
|
|
removeObjVar (player, "conversation.fs_experience_converter.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Welcome, friend! Come here and tell me what insight I may provide for you today?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Welcome, friend! Come here and tell me what insight I may provide for you today?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I wish to learn new uses of the Force.
|
|
if (branchId == 1 && response == "s_69a7c6ca")
|
|
{
|
|
//-- [NOTE]
|
|
if (fs_experience_converter_condition__defaultCondition (player, self))
|
|
{
|
|
fs_experience_converter_action_showSUIUnlock (player, self);
|
|
|
|
//-- NPC: Allow me to help you to open your mind to new possibilities...
|
|
string_id message = new string_id (c_stringFile, "s_433c2a58");
|
|
removeObjVar (player, "conversation.fs_experience_converter.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Welcome, friend! Come here and tell me what insight I may provide for you today?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Welcome, friend! Come here and tell me what insight I may provide for you today?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What aspects of the Force am I ready to learn?
|
|
if (branchId == 1 && response == "s_e4c01185")
|
|
{
|
|
//-- [NOTE]
|
|
if (fs_experience_converter_condition__defaultCondition (player, self))
|
|
{
|
|
//-- NPC: I sense that you are able to learn the following: %TO
|
|
string_id message = new string_id (c_stringFile, "s_7abe0196");
|
|
removeObjVar (player, "conversation.fs_experience_converter.branchId");
|
|
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (self);
|
|
pp.other.set (fs_experience_converter_tokenTO_branchList (player, self));
|
|
|
|
npcSpeak (player, pp);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Welcome, friend! Come here and tell me what insight I may provide for you today?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
removeObjVar (player, "conversation.fs_experience_converter.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|