mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-10-12 03:13:00 -04:00
493 lines
14 KiB
Plaintext
493 lines
14 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// bestine_artist02.script
|
|
// Copyright 2004, Sony Online Entertainment
|
|
// All Rights Reserved.
|
|
//
|
|
// 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_artist02";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean bestine_artist02_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean bestine_artist02_condition_hasFeaturedArt (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(npc, "bestine.museumEventWinner") )
|
|
{
|
|
string winner = getStringObjVar(npc, "bestine.museumEventWinner");
|
|
if ( winner.equals("bestine_artist02") )
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean bestine_artist02_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_artist02") )
|
|
return true;
|
|
|
|
if ( entry02.equals("bestine_artist02") )
|
|
return true;
|
|
|
|
if ( entry03.equals("bestine_artist02") )
|
|
return true;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean bestine_artist02_condition_hasFeaturedArt_EventActive (obj_id player, obj_id npc)
|
|
{
|
|
return ( (bestine_artist02_condition_isActiveInEvent(player, npc)) && (bestine_artist02_condition_hasFeaturedArt(player, npc)) );
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean bestine_artist02_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_artist02_condition_hasSpokenTo (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(npc, "bestine.museumEventStarted") )
|
|
{
|
|
if ( hasObjVar(player, "bestine.spokeToArtist02") )
|
|
{
|
|
int eventNum = getIntObjVar(npc, "bestine.museumEventStarted");
|
|
int playerEventNum = getIntObjVar(player, "bestine.spokeToArtist02");
|
|
if ( playerEventNum >= eventNum )
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void bestine_artist02_action_setHasSpokenTo (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(npc, "bestine.museumEventStarted") )
|
|
{
|
|
int currentEventNum = getIntObjVar(npc, "bestine.museumEventStarted");
|
|
setObjVar(player, "bestine.spokeToArtist02", currentEventNum);
|
|
|
|
if ( hasObjVar(player, "museumEventPlayer") )
|
|
removeObjVar(player, "museumEventPlayer");
|
|
}
|
|
return;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script %TO Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DI Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Script %DF Tokens
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// handleBranch<n> Functions
|
|
// ======================================================================
|
|
|
|
int bestine_artist02_handleBranch1 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Hello. Did you know I have a painting in the Bestine Museum? It's true. I'm trying to be humble, but I've never been so proud of myself.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Actually that's what I'm here to talk about. They wish to feature another work of art.
|
|
if (response == "s_59b34fc5")
|
|
{
|
|
//-- [NOTE]
|
|
if (!bestine_artist02_condition_hasSpokenTo (player, npc))
|
|
{
|
|
bestine_artist02_action_setHasSpokenTo (player, npc);
|
|
|
|
//-- NPC: Yet another opportunity!
|
|
string_id message = new string_id (c_stringFile, "s_5b1a751");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist02.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (bestine_artist02_condition_hasSpokenTo (player, npc))
|
|
{
|
|
//-- NPC: Didn't you already ask me about that? Oh well...
|
|
string_id message = new string_id (c_stringFile, "s_1fa7f38");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist02.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: You should be proud.
|
|
if (response == "s_2d2a7797")
|
|
{
|
|
//-- [NOTE]
|
|
if (bestine_artist02_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Thank you. I encourage you to go see my painting. I did mention that it's in the Bestine Museum, yes?
|
|
string_id message = new string_id (c_stringFile, "s_8f58f4f9");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist02.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
int bestine_artist02_handleBranch5 (obj_id player, obj_id npc, string_id response)
|
|
{
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Hello. Sit and have a drink with me.
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Tell me about your artwork. The Bestine Museum wishes to maybe feature it.
|
|
if (response == "s_96628254")
|
|
{
|
|
//-- [NOTE]
|
|
if (!bestine_artist02_condition_hasSpokenTo (player, npc))
|
|
{
|
|
bestine_artist02_action_setHasSpokenTo (player, npc);
|
|
|
|
//-- NPC: How exciting! I've been involved in such things before and always enjoy the opportunity.
|
|
string_id message = new string_id (c_stringFile, "s_3a6247ed");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist02.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (bestine_artist02_condition_hasSpokenTo (player, npc))
|
|
{
|
|
//-- NPC: Wait, didn't we already... I mean... ah never mind.
|
|
string_id message = new string_id (c_stringFile, "s_9467cd8b");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist02.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Okay, hand me a bottle of whatever you're drinking.
|
|
if (response == "s_f0611875")
|
|
{
|
|
//-- [NOTE]
|
|
if (bestine_artist02_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Er... um... on second thought, maybe I'd be better off drinking alone.
|
|
string_id message = new string_id (c_stringFile, "s_707098b5");
|
|
utils.removeScriptVar (player, "conversation.bestine_artist02.branchId");
|
|
|
|
npcEndConversationWithMessage (player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "conversation.bestine_artist02");
|
|
|
|
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_artist02");
|
|
|
|
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_artist02_condition_hasFeaturedArt_EventActive (player, npc))
|
|
{
|
|
//-- NPC: Hello. Did you know I have a painting in the Bestine Museum? It's true. I'm trying to be humble, but I've never been so proud of myself.
|
|
string_id message = new string_id (c_stringFile, "s_5b1aeaab");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Actually that's what I'm here to talk about. They wish to feature another work of art.
|
|
boolean hasResponse0 = false;
|
|
if (!bestine_artist02_condition_hasAlreadyVoted (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: You should be proud.
|
|
boolean hasResponse1 = false;
|
|
if (bestine_artist02_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_59b34fc5");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_2d2a7797");
|
|
|
|
utils.setScriptVar (player, "conversation.bestine_artist02.branchId", 1);
|
|
|
|
npcStartConversation (player, npc, "bestine_artist02", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (bestine_artist02_condition_isActiveInEvent (player, npc))
|
|
{
|
|
//-- NPC: Hello. Sit and have a drink with me.
|
|
string_id message = new string_id (c_stringFile, "s_5722b971");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Tell me about your artwork. The Bestine Museum wishes to maybe feature it.
|
|
boolean hasResponse0 = false;
|
|
if (!bestine_artist02_condition_hasAlreadyVoted (player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Okay, hand me a bottle of whatever you're drinking.
|
|
boolean hasResponse1 = false;
|
|
if (bestine_artist02_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_96628254");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_f0611875");
|
|
|
|
utils.setScriptVar (player, "conversation.bestine_artist02.branchId", 5);
|
|
|
|
npcStartConversation (player, npc, "bestine_artist02", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (npc, player, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (bestine_artist02_condition_hasFeaturedArt (player, npc))
|
|
{
|
|
//-- NPC: Sit, friend, and listen to my grand exploits. Well, grand to me nonetheless. I've recent been honored by having a painting featured in the Bestine Museum. You should journey there and see it.
|
|
string_id message = new string_id (c_stringFile, "s_c062519");
|
|
chat.chat (npc, player, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (bestine_artist02_condition__defaultCondition (player, npc))
|
|
{
|
|
//-- NPC: Hello Friend. Slow down a bit and enjoy the day.
|
|
string_id message = new string_id (c_stringFile, "s_4823f472");
|
|
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_artist02")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id npc = self;
|
|
|
|
int branchId = utils.getIntScriptVar (player, "conversation.bestine_artist02.branchId");
|
|
|
|
if (branchId == 1 && bestine_artist02_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (branchId == 5 && bestine_artist02_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_artist02.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|