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

1481 lines
42 KiB
Plaintext

// ======================================================================
//
// respecseller.script
// Copyright 2004, Sony Online Entertainment
// All Rights Reserved.
//
// Created with SwgConversationEditor 1.37 - DO NOT EDIT THIS AUTO-GENERATED FILE!
//
// ======================================================================
// ======================================================================
// Library Includes
// ======================================================================
include library.ai_lib;
include library.beast_lib;
include library.buff;
include library.chat;
include library.conversation;
include library.respec;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/respecseller";
// ======================================================================
// Script Conditions
// ======================================================================
boolean respecseller_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean respecseller_condition_hasBoughtRespecsBefore (obj_id player, obj_id npc)
{
return hasObjVar(player, "respecsBought");
}
// ----------------------------------------------------------------------
boolean respecseller_condition_hasInventorySpace (obj_id player, obj_id npc)
{
obj_id inv = getObjectInSlot(player, "inventory");
int free = getVolumeFree(inv);
if(free < 20)
{
return false;
}
return true;
}
// ----------------------------------------------------------------------
boolean respecseller_condition_repeatCustomerHasInventorySpace (obj_id player, obj_id npc)
{
if(!hasObjVar(player, "respecsBought"))
{
// not a repeat customer if they don't have this objvar
return false;
}
obj_id inv = getObjectInSlot(player, "inventory");
int free = getVolumeFree(inv);
if(free < 20)
{
return false;
}
return true;
}
// ----------------------------------------------------------------------
boolean respecseller_condition_firstTimeCustomerHasInventorySpace (obj_id player, obj_id npc)
{
if(hasObjVar(player, "respecsBought"))
{
// not a first time customer if they have this objvar
return false;
}
obj_id inv = getObjectInSlot(player, "inventory");
int free = getVolumeFree(inv);
if(free < 20)
{
return false;
}
return true;
}
// ----------------------------------------------------------------------
boolean respecseller_condition_hasCashToCoverRespec (obj_id player, obj_id npc)
{
int cost = respec.getRespecCost(player);
int balance = getTotalMoney(player);
return cost <= balance;
}
// ----------------------------------------------------------------------
boolean respecseller_condition_hasCashToCoverReallocation (obj_id player, obj_id npc)
{
int cost = respec.getReallocationCost(player);
int balance = getTotalMoney(player);
return cost <= balance;
}
// ----------------------------------------------------------------------
boolean respecseller_condition_hasExpertiseSkill (obj_id player, obj_id npc)
{
string[] skillList = getSkillListingForPlayer(player);
if (skillList != null)
{
for ( int i = 0; i < skillList.length; ++i )
if (skillList[i].startsWith("expertise_"))
return true;
}
return false;
}
// ----------------------------------------------------------------------
boolean respecseller_condition_hasExpertiseAllocated (obj_id player, obj_id npc)
{
return hasSkill(player, "internal_expertise_autoallocated");
}
// ----------------------------------------------------------------------
boolean respecseller_condition_hasFreeReallocations (obj_id player, obj_id npc)
{
return respec.hasFreeReallocation(player);
}
// ----------------------------------------------------------------------
boolean respecseller_condition_hasTwoOrMoreFreeRealloc (obj_id player, obj_id npc)
{
{
if (respec.numFreeAllocations(player) == 1)
return true;
}
return false;
}
// ----------------------------------------------------------------------
boolean respecseller_condition_hasNoMoreFreeRealloc (obj_id player, obj_id npc)
{
{
if (respec.numFreeAllocations(player) == 0)
return true;
}
return false;
}
// ----------------------------------------------------------------------
boolean respecseller_condition_hasCloningSickness (obj_id player, obj_id npc)
{
return buff.hasBuff(player, "cloning_sickness");
}
// ======================================================================
// Script Actions
// ======================================================================
void respecseller_action_buyRespecToken (obj_id player, obj_id npc)
{
respec.startNpcRespec(player, npc);
}
// ----------------------------------------------------------------------
void respecseller_action_removeAutoExpertise (obj_id player, obj_id npc)
{
//reset the expertise
utils.fullExpertiseReset(player, true);
revokeSkill(player, "internal_expertise_autoallocated");
if ( !hasSkill(player, "expertise") )
{
grantSkill(player, "expertise");
}
}
// ----------------------------------------------------------------------
void respecseller_action_buyReallocation (obj_id player, obj_id npc)
{
respec.handleNpcRealloc(player);
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
string respecseller_tokenTO_tokenTO0001 (obj_id player, obj_id npc)
{
return new string();
}
// ======================================================================
// Script %DI Tokens
// ======================================================================
int respecseller_tokenDI_respecCost (obj_id player, obj_id npc)
{
return respec.getRespecCost(player);
}
// ----------------------------------------------------------------------
int respecseller_tokenDI_reallocCost (obj_id player, obj_id npc)
{
return respec.getReallocationCost(player);
}
// ----------------------------------------------------------------------
int respecseller_tokenDI_numFreeAlloc (obj_id player, obj_id npc)
{
return respec.numFreeAllocations(player);
}
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// handleBranch<n> Functions
// ======================================================================
int respecseller_handleBranch1 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Greetings. Are you interested in changing professions? Perhaps resetting your expertise is more what you had in mind?
//-- [RESPONSE NOTE]
//-- PLAYER: I'm interested in changing my profession, but how much does it cost?
if (response == "s_32")
{
//-- [NOTE]
if (respecseller_condition_hasCloningSickness (player, npc))
{
//-- NPC: It looks like you are currently experiencing cloning sickness. Please come back and speak with me when you are feeling better.
string_id message = new string_id (c_stringFile, "s_90");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (respecseller_condition_firstTimeCustomerHasInventorySpace (player, npc))
{
doAnimationAction (npc, "explain");
//-- NPC: First time is always free (be sure to tell all your friends). Do you want to use your free respec at this time? Remember that you will lose any experience you might have earned towards your next level if you go through with this.
string_id message = new string_id (c_stringFile, "s_58");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes, please.
boolean hasResponse0 = false;
if (respecseller_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: No thanks.
boolean hasResponse1 = false;
if (respecseller_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_60");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_64");
utils.setScriptVar (player, "conversation.respecseller.branchId", 21);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (respecseller_condition_repeatCustomerHasInventorySpace (player, npc))
{
doAnimationAction (npc, "apologize");
//-- NPC: This time the price will be %DI credits, which is a complete bargain. Prices might go up next week, so you should think about buying right now!
string_id message = new string_id (c_stringFile, "s_68");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Those prices are criminal! I don't think so.
boolean hasResponse0 = false;
if (respecseller_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: WHAT!?!? Jabba The Hutt has better deals than that...but okay. I'll take it
boolean hasResponse1 = false;
if (respecseller_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_75");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_79");
utils.setScriptVar (player, "conversation.respecseller.branchId", 24);
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_respecCost (player, npc);
npcSpeak (player, pp);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.respecseller.branchId");
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_respecCost (player, npc);
npcEndConversationWithMessage (player, pp);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (!respecseller_condition_hasInventorySpace (player, npc))
{
//-- NPC: Since you'll be receiving potentially several items during this process, you will need at least 20 available slots in your inventory before we can proceed.
string_id message = new string_id (c_stringFile, "s_92");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Resetting my expertise sounds interesting, but how much will it cost me?
if (response == "s_33")
{
//-- [NOTE]
if (respecseller_condition_hasCloningSickness (player, npc))
{
//-- NPC: It looks like you are currently experiencing cloning sickness. Please come back and speak with me when you are feeling better.
string_id message = new string_id (c_stringFile, "s_89");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (respecseller_condition_hasExpertiseAllocated (player, npc))
{
//-- NPC: I'll tell you what, since this is your first time I will give you a special deal. That's right, free!
string_id message = new string_id (c_stringFile, "s_35");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: That sounds like a good deal to me, I'll take it.
boolean hasResponse0 = false;
if (respecseller_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: No thanks.
boolean hasResponse1 = false;
if (respecseller_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_37");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_45");
utils.setScriptVar (player, "conversation.respecseller.branchId", 3);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (respecseller_condition_hasTwoOrMoreFreeRealloc (player, npc))
{
//-- NPC: Alright, I can give it to you for free again today, but remember you only have %DI free reset left after this!
string_id message = new string_id (c_stringFile, "s_36");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: That sounds good, I'll take it.
boolean hasResponse0 = false;
if (respecseller_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I think I'll hold off on that for today.
boolean hasResponse1 = false;
if (respecseller_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_47");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_51");
utils.setScriptVar (player, "conversation.respecseller.branchId", 6);
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_numFreeAlloc (player, npc);
npcSpeak (player, pp);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.respecseller.branchId");
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_numFreeAlloc (player, npc);
npcEndConversationWithMessage (player, pp);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (respecseller_condition_hasNoMoreFreeRealloc (player, npc))
{
//-- NPC: Alright, I can give it to you for free again today, but this is the last time.
string_id message = new string_id (c_stringFile, "s_80");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: That sounds good, I'll take it.
boolean hasResponse0 = false;
if (respecseller_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I think I'll hold off on that for today.
boolean hasResponse1 = false;
if (respecseller_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_81");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_82");
utils.setScriptVar (player, "conversation.respecseller.branchId", 9);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (respecseller_condition_hasFreeReallocations (player, npc))
{
//-- NPC: Alright, I can give it to you for free again today, but remember you have %DI free resets left after this!
string_id message = new string_id (c_stringFile, "s_70");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: That sounds good, I'll take it.
boolean hasResponse0 = false;
if (respecseller_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I think I'll hold off on that for today.
boolean hasResponse1 = false;
if (respecseller_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_71");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_72");
utils.setScriptVar (player, "conversation.respecseller.branchId", 12);
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_numFreeAlloc (player, npc);
npcSpeak (player, pp);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.respecseller.branchId");
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_numFreeAlloc (player, npc);
npcEndConversationWithMessage (player, pp);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
//-- NPC: This time the price will be %DI credits, which is a complete bargain. Prices might go up next week, so you should think about buying right now!
string_id message = new string_id (c_stringFile, "s_49");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: That's a bit too much if you ask me.
boolean hasResponse0 = false;
if (respecseller_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: Those prices are ridiculous...but okay. I'll take it.
boolean hasResponse1 = false;
if (respecseller_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_53");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_54");
utils.setScriptVar (player, "conversation.respecseller.branchId", 15);
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_reallocCost (player, npc);
npcSpeak (player, pp);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.respecseller.branchId");
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_reallocCost (player, npc);
npcEndConversationWithMessage (player, pp);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int respecseller_handleBranch3 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: I'll tell you what, since this is your first time I will give you a special deal. That's right, free!
//-- [RESPONSE NOTE]
//-- PLAYER: That sounds like a good deal to me, I'll take it.
if (response == "s_37")
{
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
respecseller_action_removeAutoExpertise (player, npc);
//-- NPC: Our business is concluded then. Farewell.
string_id message = new string_id (c_stringFile, "s_38");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: No thanks.
if (response == "s_45")
{
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
//-- NPC: Very well. Best of luck to you!
string_id message = new string_id (c_stringFile, "s_46");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int respecseller_handleBranch6 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Alright, I can give it to you for free again today, but remember you only have %DI free reset left after this!
//-- [RESPONSE NOTE]
//-- PLAYER: That sounds good, I'll take it.
if (response == "s_47")
{
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
respecseller_action_buyReallocation (player, npc);
//-- NPC: Our business is concluded then. Farewell.
string_id message = new string_id (c_stringFile, "s_50");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I think I'll hold off on that for today.
if (response == "s_51")
{
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
//-- NPC: Very well. Best of luck to you!
string_id message = new string_id (c_stringFile, "s_52");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int respecseller_handleBranch9 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Alright, I can give it to you for free again today, but this is the last time.
//-- [RESPONSE NOTE]
//-- PLAYER: That sounds good, I'll take it.
if (response == "s_81")
{
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
respecseller_action_buyReallocation (player, npc);
//-- NPC: Our business is concluded then. Farewell.
string_id message = new string_id (c_stringFile, "s_83");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I think I'll hold off on that for today.
if (response == "s_82")
{
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
//-- NPC: Very well. Best of luck to you!
string_id message = new string_id (c_stringFile, "s_84");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int respecseller_handleBranch12 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Alright, I can give it to you for free again today, but remember you have %DI free resets left after this!
//-- [RESPONSE NOTE]
//-- PLAYER: That sounds good, I'll take it.
if (response == "s_71")
{
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
respecseller_action_buyReallocation (player, npc);
//-- NPC: Our business is concluded then. Farewell.
string_id message = new string_id (c_stringFile, "s_73");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: I think I'll hold off on that for today.
if (response == "s_72")
{
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
//-- NPC: Very well. Best of luck to you!
string_id message = new string_id (c_stringFile, "s_74");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int respecseller_handleBranch15 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: This time the price will be %DI credits, which is a complete bargain. Prices might go up next week, so you should think about buying right now!
//-- [RESPONSE NOTE]
//-- PLAYER: That's a bit too much if you ask me.
if (response == "s_53")
{
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "manipulate_high");
//-- NPC: Very well. Good day then.
string_id message = new string_id (c_stringFile, "s_55");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Those prices are ridiculous...but okay. I'll take it.
if (response == "s_54")
{
//-- [NOTE]
if (respecseller_condition_hasCashToCoverReallocation (player, npc))
{
respecseller_action_buyReallocation (player, npc);
//-- NPC: Our business is concluded then. Farewell.
string_id message = new string_id (c_stringFile, "s_56");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (!respecseller_condition_hasCashToCoverReallocation (player, npc))
{
//-- NPC: Unfortunately you don't have %DI credits to cover the procedure. Come back when you've saved up some more money. Good day!
string_id message = new string_id (c_stringFile, "s_57");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_reallocCost (player, npc);
npcEndConversationWithMessage (player, pp);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int respecseller_handleBranch19 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Greetings. Are you interested in changing professions? If so, I might be able to help you. Recent advances in Mon-Cal neuro-nanite technologies have enabled us to transmute the knowledge you possess of your current profession to that of a different profession.
//-- [RESPONSE NOTE]
//-- PLAYER: Sounds good, but how much is it going to cost me?
if (response == "s_43")
{
//-- [NOTE]
if (respecseller_condition_hasCloningSickness (player, npc))
{
//-- NPC: It looks like you are currently experiencing cloning sickness. Please come back and speak with me when you are feeling better.
string_id message = new string_id (c_stringFile, "s_90");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (respecseller_condition_firstTimeCustomerHasInventorySpace (player, npc))
{
doAnimationAction (npc, "explain");
//-- NPC: First time is always free (be sure to tell all your friends). Do you want to use your free respec at this time? Remember that you will lose any experience you might have earned towards your next level if you go through with this.
string_id message = new string_id (c_stringFile, "s_58");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes, please.
boolean hasResponse0 = false;
if (respecseller_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: No thanks.
boolean hasResponse1 = false;
if (respecseller_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_60");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_64");
utils.setScriptVar (player, "conversation.respecseller.branchId", 21);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (respecseller_condition_repeatCustomerHasInventorySpace (player, npc))
{
doAnimationAction (npc, "apologize");
//-- NPC: This time the price will be %DI credits, which is a complete bargain. Prices might go up next week, so you should think about buying right now!
string_id message = new string_id (c_stringFile, "s_68");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Those prices are criminal! I don't think so.
boolean hasResponse0 = false;
if (respecseller_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: WHAT!?!? Jabba The Hutt has better deals than that...but okay. I'll take it
boolean hasResponse1 = false;
if (respecseller_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_75");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_79");
utils.setScriptVar (player, "conversation.respecseller.branchId", 24);
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_respecCost (player, npc);
npcSpeak (player, pp);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.respecseller.branchId");
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_respecCost (player, npc);
npcEndConversationWithMessage (player, pp);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (!respecseller_condition_hasInventorySpace (player, npc))
{
//-- NPC: Since you'll be receiving potentially several items during this process, you will need at least 20 available slots in your inventory before we can proceed.
string_id message = new string_id (c_stringFile, "s_92");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int respecseller_handleBranch21 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: First time is always free (be sure to tell all your friends). Do you want to use your free respec at this time? Remember that you will lose any experience you might have earned towards your next level if you go through with this.
//-- [RESPONSE NOTE]
//-- PLAYER: Yes, please.
if (response == "s_60")
{
doAnimationAction (player, "nod");
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "bow");
respecseller_action_buyRespecToken (player, npc);
//-- NPC: Our business is concluded then. Farewell.
string_id message = new string_id (c_stringFile, "s_62");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: No thanks.
if (response == "s_64")
{
doAnimationAction (player, "shake_head_no");
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "wave1");
//-- NPC: Very well. Best of luck to you!
string_id message = new string_id (c_stringFile, "s_66");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int respecseller_handleBranch24 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: This time the price will be %DI credits, which is a complete bargain. Prices might go up next week, so you should think about buying right now!
//-- [RESPONSE NOTE]
//-- PLAYER: Those prices are criminal! I don't think so.
if (response == "s_75")
{
doAnimationAction (player, "pound_fist_palm");
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "manipulate_high");
//-- NPC: Very well. Good day then.
string_id message = new string_id (c_stringFile, "s_77");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: WHAT!?!? Jabba The Hutt has better deals than that...but okay. I'll take it
if (response == "s_79")
{
doAnimationAction (player, "scream");
//-- [NOTE]
if (respecseller_condition_hasCashToCoverRespec (player, npc))
{
respecseller_action_buyRespecToken (player, npc);
//-- NPC: Our business is concluded then. Farewell.
string_id message = new string_id (c_stringFile, "s_86");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (!respecseller_condition_hasCashToCoverRespec (player, npc))
{
//-- NPC: Unfortunately you don't have %DI credits to cover the procedure. Come back when you've saved up some more money. Good day!
string_id message = new string_id (c_stringFile, "s_88");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
prose_package pp = new prose_package ();
pp.stringId = message;
pp.actor.set (player);
pp.target.set (npc);
pp.digitInteger = respecseller_tokenDI_respecCost (player, npc);
npcEndConversationWithMessage (player, pp);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isTangible (self)) || (isPlayer (self)))
detachScript(self, "conversation.respecseller");
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.respecseller");
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 (respecseller_condition_hasExpertiseSkill (player, npc))
{
//-- NPC: Greetings. Are you interested in changing professions? Perhaps resetting your expertise is more what you had in mind?
string_id message = new string_id (c_stringFile, "s_31");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I'm interested in changing my profession, but how much does it cost?
boolean hasResponse0 = false;
if (respecseller_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: Resetting my expertise sounds interesting, but how much will it cost me?
boolean hasResponse1 = false;
if (respecseller_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_32");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_33");
utils.setScriptVar (player, "conversation.respecseller.branchId", 1);
npcStartConversation (player, npc, "respecseller", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (respecseller_condition__defaultCondition (player, npc))
{
doAnimationAction (npc, "wave2");
//-- NPC: Greetings. Are you interested in changing professions? If so, I might be able to help you. Recent advances in Mon-Cal neuro-nanite technologies have enabled us to transmute the knowledge you possess of your current profession to that of a different profession.
string_id message = new string_id (c_stringFile, "s_41");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Sounds good, but how much is it going to cost me?
boolean hasResponse0 = false;
if (respecseller_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_43");
utils.setScriptVar (player, "conversation.respecseller.branchId", 19);
npcStartConversation (player, npc, "respecseller", 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 != "respecseller")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.respecseller.branchId");
if (branchId == 1 && respecseller_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 3 && respecseller_handleBranch3 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 6 && respecseller_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 9 && respecseller_handleBranch9 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 12 && respecseller_handleBranch12 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 15 && respecseller_handleBranch15 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 19 && respecseller_handleBranch19 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 21 && respecseller_handleBranch21 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 24 && respecseller_handleBranch24 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar (player, "conversation.respecseller.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================