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

555 lines
16 KiB
Plaintext

// ======================================================================
//
// mtp_kissing_booth.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.buff;
include library.chat;
include library.conversation;
include library.static_item;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/mtp_kissing_booth";
// ======================================================================
// Script Conditions
// ======================================================================
boolean mtp_kissing_booth_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean mtp_kissing_booth_condition_hasBuffAlready (obj_id player, obj_id npc)
{
if(buff.hasBuff(player, "mtp_meatlump_kiss_buff") || buff.hasBuff(player, "mtp_meatlump_kiss_debuff"))
{
//sendSystemMessage(giver, SID_ALREADY_HAS_KISS_BUFF);
return true;
}
return false;
}
// ======================================================================
// Script Actions
// ======================================================================
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// handleBranch<n> Functions
// ======================================================================
int mtp_kissing_booth_handleBranch1 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: It looks like we already gave you a kiss. You can save Lumps if you wait until your infatuation has wained.
//-- [RESPONSE NOTE]
//-- PLAYER: Ah...Ok, I'll try back later.
if (response == "s_18")
{
//-- [NOTE]
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
//-- NPC: See you in a bit. Next Please!
string_id message = new string_id (c_stringFile, "s_21");
utils.removeScriptVar (player, "conversation.mtp_kissing_booth.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: But I want another kiss!
if (response == "s_19")
{
//-- [NOTE]
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
//-- NPC: There will be plenty to go around, try back later.
string_id message = new string_id (c_stringFile, "s_20");
utils.removeScriptVar (player, "conversation.mtp_kissing_booth.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Your kisses are diseased! Help!
if (response == "s_22")
{
//-- [NOTE]
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
//-- NPC: If you'd like to file a complaint, please see the Meatlump Complaint Department.
string_id message = new string_id (c_stringFile, "s_23");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Where is the complaint department?
boolean hasResponse0 = false;
if (mtp_kissing_booth_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_24");
utils.setScriptVar (player, "conversation.mtp_kissing_booth.branchId", 4);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.mtp_kissing_booth.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int mtp_kissing_booth_handleBranch4 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: If you'd like to file a complaint, please see the Meatlump Complaint Department.
//-- [RESPONSE NOTE]
//-- PLAYER: Where is the complaint department?
if (response == "s_24")
{
//-- [NOTE]
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
//-- NPC: It's around here somewhere.
string_id message = new string_id (c_stringFile, "s_25");
utils.removeScriptVar (player, "conversation.mtp_kissing_booth.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int mtp_kissing_booth_handleBranch6 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Step right up and get a kiss from one of our attractive Meatlumps. Guaranteed to make you feel all mushy or you get your Lump back!
//-- [RESPONSE NOTE]
//-- PLAYER: I'd like a kiss.
if (response == "s_6")
{
//-- [NOTE]
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
//-- NPC: Kisses cost one Lump. Hand it to me for your kiss.
string_id message = new string_id (c_stringFile, "s_8");
utils.removeScriptVar (player, "conversation.mtp_kissing_booth.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Kisses cost lumps?
if (response == "s_10")
{
//-- [NOTE]
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
//-- NPC: Just one Lump will get you a kiss. Hand me a Lump if you're interested.
string_id message = new string_id (c_stringFile, "s_12");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: No way! That's way too expensive!
boolean hasResponse0 = false;
if (mtp_kissing_booth_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_14");
utils.setScriptVar (player, "conversation.mtp_kissing_booth.branchId", 8);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.mtp_kissing_booth.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int mtp_kissing_booth_handleBranch8 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Just one Lump will get you a kiss. Hand me a Lump if you're interested.
//-- [RESPONSE NOTE]
//-- PLAYER: No way! That's way too expensive!
if (response == "s_14")
{
//-- [NOTE]
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
//-- NPC: Next in line please!
string_id message = new string_id (c_stringFile, "s_16");
utils.removeScriptVar (player, "conversation.mtp_kissing_booth.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
const string_id SID_NOT_A_LUMP = new string_id("collection", "not_a_lump");
const string_id SID_ALREADY_HAS_KISS_BUFF = new string_id("collection", "has_kiss_buff");
trigger OnInitialize ()
{
if ((!isTangible (self)) || (isPlayer (self)))
detachScript(self, "conversation.mtp_kissing_booth");
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.mtp_kissing_booth");
return SCRIPT_CONTINUE;
}
trigger OnGiveItem (obj_id item, obj_id giver)
{
if(!isIdValid(giver) || !exists(giver))
return SCRIPT_CONTINUE;
if(!isIdValid(item) || !exists(item))
return SCRIPT_CONTINUE;
if(buff.hasBuff(giver, "mtp_meatlump_kiss_buff") || buff.hasBuff(giver, "mtp_meatlump_kiss_debuff"))
{
sendSystemMessage(giver, SID_ALREADY_HAS_KISS_BUFF);
return SCRIPT_CONTINUE;
}
string itemName = getStaticItemName(item);
if(!itemName.equals("item_meatlump_lump_01_01"))
{
sendSystemMessage(giver, SID_NOT_A_LUMP);
return SCRIPT_CONTINUE;
}
else
{
int myRoll = rand(1, 100);
if(isGod(giver))
{
sendSystemMessageTestingOnly(giver, "you rolled: " + myRoll + " You must roll 10 or less for the debuff");
}
if(myRoll > 10)
{
static_item.decrementStaticItem(item);
//make sure you are facing the player.
faceTo(self, giver);
//blow the player a kiss
chat.think(self, " blows you a kiss");
doAnimationAction(self, "kiss");
doAnimationAction(giver, "kiss");
buff.applyBuff(giver, self,"mtp_meatlump_kiss_buff");
}
else
{
static_item.decrementStaticItem(item);
//make sure you are facing the player.
faceTo(self, giver);
//blow the player a kiss
chat.think(self, " blows you a kiss");
doAnimationAction(self, "kiss");
doAnimationAction(giver, "kiss");
buff.applyBuff(giver, self,"mtp_meatlump_kiss_debuff");
}
}
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 (mtp_kissing_booth_condition_hasBuffAlready (player, npc))
{
//-- NPC: It looks like we already gave you a kiss. You can save Lumps if you wait until your infatuation has wained.
string_id message = new string_id (c_stringFile, "s_17");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Ah...Ok, I'll try back later.
boolean hasResponse0 = false;
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: But I want another kiss!
boolean hasResponse1 = false;
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: Your kisses are diseased! Help!
boolean hasResponse2 = false;
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_18");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_19");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_22");
utils.setScriptVar (player, "conversation.mtp_kissing_booth.branchId", 1);
npcStartConversation (player, npc, "mtp_kissing_booth", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
//-- NPC: Step right up and get a kiss from one of our attractive Meatlumps. Guaranteed to make you feel all mushy or you get your Lump back!
string_id message = new string_id (c_stringFile, "s_4");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I'd like a kiss.
boolean hasResponse0 = false;
if (mtp_kissing_booth_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: Kisses cost lumps?
boolean hasResponse1 = false;
if (mtp_kissing_booth_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_6");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_10");
utils.setScriptVar (player, "conversation.mtp_kissing_booth.branchId", 6);
npcStartConversation (player, npc, "mtp_kissing_booth", 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 != "mtp_kissing_booth")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.mtp_kissing_booth.branchId");
if (branchId == 1 && mtp_kissing_booth_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 4 && mtp_kissing_booth_handleBranch4 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 6 && mtp_kissing_booth_handleBranch6 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 8 && mtp_kissing_booth_handleBranch8 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar (player, "conversation.mtp_kissing_booth.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================