mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
307 lines
8.9 KiB
Plaintext
307 lines
8.9 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// clone_droid.script
|
|
//
|
|
//
|
|
//
|
|
// Created with SwgConversationEditor 1.37 - DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
//
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Library Includes
|
|
// ======================================================================
|
|
|
|
include library.ai_lib;
|
|
include library.buff;
|
|
include library.chat;
|
|
include library.conversation;
|
|
include library.pclib;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/clone_droid";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean clone_droid_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean clone_droid_condition_isSick (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc,player);
|
|
return buff.hasBuff(player, "cloning_sickness");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean clone_droid_condition_canAffordCure (obj_id player, obj_id npc)
|
|
{
|
|
faceTo(npc,player);
|
|
return pclib.canAffordCloningSicknessCure(player);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void clone_droid_action_payForCure (obj_id player, obj_id npc)
|
|
{
|
|
pclib.cureCloningSickness(player);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
int clone_droid_tokenDI_cureCost (obj_id player, obj_id npc)
|
|
{
|
|
return pclib.getCloningSicknessCureCost(player);
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int clone_droid_handleBranch2 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Unfortunately the cloning process can make you quite ill and incompetent in battle for a while. For %DI credits I can give you an injection to cure the illness immediately.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: That's a little steep. Are there any other options?
|
|
if (response == "s_8")
|
|
{
|
|
//-- [NOTE]
|
|
if (clone_droid_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: I recommend relaxing with one of the many Entertainers in the galaxy. If that doesn't suit your fancy, you'll just have to wait it out, I'm afraid.
|
|
string_id message = new string_id (c_stringFile, "s_10");
|
|
utils.removeScriptVar (player, "conversation.clone_droid.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Fine. I'll pay.
|
|
if (response == "s_12")
|
|
{
|
|
//-- [NOTE]
|
|
if (clone_droid_condition_canAffordCure (player, npc))
|
|
{
|
|
clone_droid_action_payForCure (player, npc);
|
|
|
|
//-- NPC: My scans indicate that you are in perfect health. How do you feel?
|
|
string_id message = new string_id (c_stringFile, "s_14");
|
|
utils.removeScriptVar (player, "conversation.clone_droid.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (!clone_droid_condition_canAffordCure (player, npc))
|
|
{
|
|
//-- NPC: You don't have the funds in your bank to cover the transaction.
|
|
string_id message = new string_id (c_stringFile, "s_16");
|
|
utils.removeScriptVar (player, "conversation.clone_droid.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isTangible (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.clone_droid");
|
|
|
|
setInvulnerable(self, true);
|
|
|
|
setCondition (self, CONDITION_CONVERSABLE);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
setInvulnerable(self, true);
|
|
|
|
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.clone_droid");
|
|
|
|
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 (!clone_droid_condition_isSick (player, npc))
|
|
{
|
|
//-- NPC: You look well enough to me. Off you go.
|
|
string_id message = new string_id (c_stringFile, "s_4");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (clone_droid_condition_isSick (player, npc))
|
|
{
|
|
//-- NPC: Unfortunately the cloning process can make you quite ill and incompetent in battle for a while. For %DI credits I can give you an injection to cure the illness immediately.
|
|
string_id message = new string_id (c_stringFile, "s_6");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: That's a little steep. Are there any other options?
|
|
boolean hasResponse0 = false;
|
|
if (clone_droid_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Fine. I'll pay.
|
|
boolean hasResponse1 = false;
|
|
if (clone_droid_condition__defaultCondition (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses [] = new string_id [numberOfResponses];
|
|
|
|
if (hasResponse0)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_8");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_12");
|
|
|
|
utils.setScriptVar (player, "conversation.clone_droid.branchId", 2);
|
|
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
pp.digitInteger = clone_droid_tokenDI_cureCost (player, npc);
|
|
|
|
npcStartConversation (player, npc, "clone_droid", null, pp, responses);
|
|
}
|
|
else
|
|
{
|
|
prose_package pp = new prose_package ();
|
|
pp.stringId = message;
|
|
pp.actor.set (player);
|
|
pp.target.set (npc);
|
|
pp.digitInteger = clone_droid_tokenDI_cureCost (player, 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 != "clone_droid")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.clone_droid.branchId");
|
|
|
|
if (branchId == 2 && clone_droid_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.clone_droid.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|