Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/junk_nado_wattos.script
T
2013-09-10 23:17:15 -07:00

355 lines
11 KiB
Plaintext

// ======================================================================
//
// junk_nado_wattos.script
// Copyright 2004, Sony Online Entertainment
// All Rights Reserved.
//
// Created with SwgConversationEditor 1.36 - DO NOT EDIT THIS AUTO-GENERATED FILE!
//
// ======================================================================
// ======================================================================
// Library Includes
// ======================================================================
include library.ai_lib;
include library.chat;
include library.smuggler;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/junk_nado_wattos";
// ======================================================================
// Script Conditions
// ======================================================================
boolean junk_nado_wattos_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean junk_nado_wattos_condition_check_inv (obj_id player, obj_id npc)
{
return smuggler.checkInventory(player, npc);
}
// ======================================================================
// Script Actions
// ======================================================================
void junk_nado_wattos_action_start_dealing (obj_id player, obj_id npc)
{
dictionary params = new dictionary();
params.put("player", player);
messageTo(npc, "startDealing", params, 1.0f, false);
}
// ----------------------------------------------------------------------
void junk_nado_wattos_action_face_to (obj_id player, obj_id npc)
{
faceTo(npc, player);
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// handleBranch<n> Functions
// ======================================================================
int junk_nado_wattos_handleBranch1 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Eh? Ah yes, I can tell by your look that you have something that I might be interested in buying. Well that is what Watto's is here for.
//-- [RESPONSE NOTE]
//-- PLAYER: What sort of things do you buy?
if (response == "s_d94d5d64")
{
//-- [NOTE]
if (junk_nado_wattos_condition__defaultCondition (player, npc))
{
//-- NPC: We deal in a wide assortment of goods and offer the best prices on Tatooine for junk. A large number of settlers come to Watto's looking for various parts and nic-naks to suit their purpose.
string_id message = new string_id (c_stringFile, "s_17e67aee");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I think I might have a few things that will spark your interest.
boolean hasResponse0 = false;
if (junk_nado_wattos_condition_check_inv (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I am sorry but I don't have anything you would be interested in.
boolean hasResponse1 = false;
if (junk_nado_wattos_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_a5d02a3c");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_90b63763");
utils.setScriptVar (player, "conversation.junk_nado_wattos.branchId", 2);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.junk_nado_wattos.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I am just taking a look around.
if (response == "s_50c8b3e1")
{
//-- [NOTE]
if (junk_nado_wattos_condition__defaultCondition (player, npc))
{
//-- NPC: If there is anything that I can help you with just let me know.
string_id message = new string_id (c_stringFile, "s_294d7f51");
utils.removeScriptVar (player, "conversation.junk_nado_wattos.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int junk_nado_wattos_handleBranch2 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: We deal in a wide assortment of goods and offer the best prices on Tatooine for junk. A large number of settlers come to Watto's looking for various parts and nic-naks to suit their purpose.
//-- [RESPONSE NOTE]
//-- PLAYER: I think I might have a few things that will spark your interest.
if (response == "s_a5d02a3c")
{
//-- [NOTE]
if (junk_nado_wattos_condition__defaultCondition (player, npc))
{
junk_nado_wattos_action_start_dealing (player, npc);
//-- NPC: Excellent. Let me take a look at what you have to offer. Hmmmm...most of this isn't in very good condition but I am more then willing to make you an offer. Let me assure you no one will give you a better price.
string_id message = new string_id (c_stringFile, "s_8441c2ce");
utils.removeScriptVar (player, "conversation.junk_nado_wattos.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I am sorry but I don't have anything you would be interested in.
if (response == "s_90b63763")
{
//-- [NOTE]
if (junk_nado_wattos_condition__defaultCondition (player, npc))
{
//-- NPC: That is alright. If you happen to come across anything you think I might like to buy stop on by and I will be more then willing to take it off your hands.
string_id message = new string_id (c_stringFile, "s_6afe640d");
utils.removeScriptVar (player, "conversation.junk_nado_wattos.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isMob (self)) || (isPlayer (self)))
detachScript(self, "conversation.junk_nado_wattos");
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.junk_nado_wattos");
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 (junk_nado_wattos_condition__defaultCondition (player, npc))
{
junk_nado_wattos_action_face_to (player, npc);
//-- NPC: Eh? Ah yes, I can tell by your look that you have something that I might be interested in buying. Well that is what Watto's is here for.
string_id message = new string_id (c_stringFile, "s_fa615166");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: What sort of things do you buy?
boolean hasResponse0 = false;
if (junk_nado_wattos_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I am just taking a look around.
boolean hasResponse1 = false;
if (junk_nado_wattos_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_d94d5d64");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_50c8b3e1");
utils.setScriptVar (player, "conversation.junk_nado_wattos.branchId", 1);
npcStartConversation (player, npc, "junk_nado_wattos", message, responses);
}
else
{
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 != "junk_nado_wattos")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.junk_nado_wattos.branchId");
if (branchId == 1 && junk_nado_wattos_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 2 && junk_nado_wattos_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.junk_nado_wattos.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================