mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-09-12 23:45:12 -04:00
493 lines
15 KiB
Plaintext
493 lines
15 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// bestine_artist01.script
|
|
//
|
|
//
|
|
//
|
|
// Created with SwgConversationEditor 1.35 - DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
//
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Library Includes
|
|
// ======================================================================
|
|
|
|
include library.ai_lib;
|
|
include library.chat;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/bestine_artist01";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean bestine_artist01_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean bestine_artist01_condition_hasFeaturedArt_inEvent (obj_id player, obj_id npc)
|
|
{
|
|
return ( (bestine_artist01_condition_isActiveInEvent(player, npc)) && (bestine_artist01_condition_hasFeaturedArt(player, npc)) );
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean bestine_artist01_condition_isActiveInEvent (obj_id player, obj_id npc)
|
|
{
|
|
if (hasObjVar(npc, "bestine.museumEventStarted") )
|
|
{
|
|
int eventNum = getIntObjVar(npc, "bestine.museumEventStarted");
|
|
if ( hasObjVar(player, "bestine.museumEventPlayer") )
|
|
{
|
|
int playerEventNum = getIntObjVar(player, "bestine.museumEventPlayer");
|
|
if ( playerEventNum >= eventNum )
|
|
{
|
|
string entry01 = "";
|
|
string entry02 = "";
|
|
string entry03 = "";
|
|
if( hasObjVar(npc, "bestine.museumEventEntry01") )
|
|
entry01 = getStringObjVar(npc, "bestine.museumEventEntry01");
|
|
|
|
if( hasObjVar(npc, "bestine.museumEventEntry02") )
|
|
entry02 = getStringObjVar(npc, "bestine.museumEventEntry02");
|
|
|
|
if( hasObjVar(npc, "bestine.museumEventEntry03") )
|
|
entry03 = getStringObjVar(npc, "bestine.museumEventEntry03");
|
|
|
|
if ( entry01.equals("bestine_artist01") )
|
|
return true;
|
|
|
|
if ( entry02.equals("bestine_artist01") )
|
|
return true;
|
|
|
|
if ( entry03.equals("bestine_artist01") )
|
|
return true;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean bestine_artist01_condition_hasFeaturedArt (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(npc, "bestine.museumEventWinner") )
|
|
{
|
|
string winner = getStringObjVar(npc, "bestine.museumEventWinner");
|
|
if ( winner.equals("bestine_artist01") )
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean bestine_artist01_condition_hasAlreadyVoted (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(npc, "bestine.museumEventStarted") )
|
|
{
|
|
if ( hasObjVar(player, "bestine.museumEventPlayerVoted") )
|
|
{
|
|
int eventNum = getIntObjVar(npc, "bestine.museumEventStarted");
|
|
int playerEventNum = getIntObjVar(player, "bestine.museumEventPlayerVoted");
|
|
if ( playerEventNum >= eventNum )
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean bestine_artist01_condition_alreadySpokenTo (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(npc, "bestine.museumEventStarted") )
|
|
{
|
|
if ( hasObjVar(player, "bestine.spokeToArtist01") )
|
|
{
|
|
int eventNum = getIntObjVar(npc, "bestine.museumEventStarted");
|
|
int playerEventNum = getIntObjVar(player, "bestine.spokeToArtist01");
|
|
if ( playerEventNum >= eventNum )
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void bestine_artist01_action_setHasSpokenTo (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(npc, "bestine.museumEventStarted") )
|
|
{
|
|
int currentEventNum = getIntObjVar(npc, "bestine.museumEventStarted");
|
|
setObjVar(player, "bestine.spokeToArtist01", currentEventNum);
|
|
|
|
if ( hasObjVar(player, "museumEventPlayer") )
|
|
removeObjVar(player, "museumEventPlayer");
|
|
}
|
|
return;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int bestine_artist01_handleBranch1 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: If you've come about that overdue rent, fear not. I've got a work of art that's being featured in the Bestine Museum. I'm sure my windfall is not far behind.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: That's why I'm here. The Bestine Museum is looking to feature another work of art.
|
|
if (response == "s_40f54223")
|
|
{
|
|
//-- [NOTE]
|
|
if (!bestine_artist01_condition_alreadySpokenTo (player, npc))
|
|
{
|
|
bestine_artist01_action_setHasSpokenTo (player, npc);
|
|
|
|
//-- NPC: Oh... well then let me tell you about my work.
|
|
string_id message = new string_id (c_stringFile, "s_908359f7");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist01.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (bestine_artist01_condition_alreadySpokenTo (player, npc))
|
|
{
|
|
//-- NPC: Wait... I remember you. You mentioned that once before. Guess there's no harm in saying it again.
|
|
string_id message = new string_id (c_stringFile, "s_378506ca");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist01.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Good luck with that.
|
|
if (response == "s_e7133472")
|
|
{
|
|
//-- [NOTE]
|
|
if (bestine_artist01_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Just wait and see... my time has come. You'll see. Soon I'll be famous all across the galaxy. Well, maybe not on Dantooine... but no one there really matters anyway.
|
|
string_id message = new string_id (c_stringFile, "s_62dd13f8");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist01.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int bestine_artist01_handleBranch5 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Yes, I'll pay... I'll pay. Wait a minute... who are you? Look, I'm busy. I don't really have time to talk right now.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Actually, I'm here about your artwork. The Bestine Museum is looking to feature a work of art.
|
|
if (response == "s_c061a6db")
|
|
{
|
|
//-- [NOTE]
|
|
if (!bestine_artist01_condition_alreadySpokenTo (player, npc))
|
|
{
|
|
bestine_artist01_action_setHasSpokenTo (player, npc);
|
|
|
|
//-- NPC: Oh... well... why didn't you say so earlier.
|
|
string_id message = new string_id (c_stringFile, "s_f58736af");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist01.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (bestine_artist01_condition_alreadySpokenTo (player, npc))
|
|
{
|
|
//-- NPC: Wait... I remember you. You asked about my artwork recently. I guess if you want to hear it again, there's no harm to me.
|
|
string_id message = new string_id (c_stringFile, "s_22e081ab");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist01.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Calm down. I was just passing by.
|
|
if (response == "s_4a276e66")
|
|
{
|
|
//-- [NOTE]
|
|
if (bestine_artist01_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Oh. Okay then. I apologize. It's just that... well, no point in going into the dirty little details. Let's just forget the whole thing.
|
|
string_id message = new string_id (c_stringFile, "s_e60617b5");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist01.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.bestine_artist01");
|
|
|
|
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.bestine_artist01");
|
|
|
|
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 (bestine_artist01_condition_hasFeaturedArt_inEvent (player, npc))
|
|
{
|
|
//-- NPC: If you've come about that overdue rent, fear not. I've got a work of art that's being featured in the Bestine Museum. I'm sure my windfall is not far behind.
|
|
string_id message = new string_id (c_stringFile, "s_21666bd5");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: That's why I'm here. The Bestine Museum is looking to feature another work of art.
|
|
boolean hasResponse0 = false;
|
|
if (!bestine_artist01_condition_hasAlreadyVoted (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Good luck with that.
|
|
boolean hasResponse1 = false;
|
|
if (bestine_artist01_condition_hasAlreadyVoted (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_40f54223");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_e7133472");
|
|
|
|
utils.setScriptVar (player, "conversation.bestine_artist01.branchId", 1);
|
|
|
|
npcStartConversation (player, npc, "bestine_artist01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (bestine_artist01_condition_isActiveInEvent (player, npc))
|
|
{
|
|
//-- NPC: Yes, I'll pay... I'll pay. Wait a minute... who are you? Look, I'm busy. I don't really have time to talk right now.
|
|
string_id message = new string_id (c_stringFile, "s_7afc26f5");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Actually, I'm here about your artwork. The Bestine Museum is looking to feature a work of art.
|
|
boolean hasResponse0 = false;
|
|
if (!bestine_artist01_condition_hasAlreadyVoted (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Calm down. I was just passing by.
|
|
boolean hasResponse1 = false;
|
|
if (bestine_artist01_condition_hasAlreadyVoted (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_c061a6db");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_4a276e66");
|
|
|
|
utils.setScriptVar (player, "conversation.bestine_artist01.branchId", 5);
|
|
|
|
npcStartConversation (player, npc, "bestine_artist01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (bestine_artist01_condition_hasFeaturedArt (player, npc))
|
|
{
|
|
//-- NPC: Are you here to collect a debt? No fear... I've got a work of art that's being featured in the Bestine Museum. It can't be long before riches follow. Oh, you're not here about money... well, even better.
|
|
string_id message = new string_id (c_stringFile, "s_b7a88f36");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (bestine_artist01_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Are you from the debt collector? I've barely a few credits to my name at the moment, so you'll get nothing from me. Be gone.
|
|
string_id message = new string_id (c_stringFile, "s_506f2192");
|
|
chat.chat (npc, player, message);
|
|
|
|
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 != "bestine_artist01")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.bestine_artist01.branchId");
|
|
|
|
if (branchId == 1 && bestine_artist01_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 5 && bestine_artist01_handleBranch5 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
utils.removeScriptVar (player, "conversation.bestine_artist01.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|