Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/quharek_phase_4.java
T
2018-06-07 00:32:29 +01:00

236 lines
10 KiB
Java
Executable File

package script.conversation;
import script.library.ai_lib;
import script.library.chat;
import script.*;
public class quharek_phase_4 extends script.base_script
{
public quharek_phase_4()
{
}
public static String c_stringFile = "conversation/quharek_phase_4";
public boolean quharek_phase_4_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException
{
return true;
}
public int OnInitialize(obj_id self) throws InterruptedException
{
if ((!isMob(self)) || (isPlayer(self)))
{
detachScript(self, "npc.conversation.quharek_phase_4");
}
setCondition(self, CONDITION_CONVERSABLE);
return SCRIPT_CONTINUE;
}
public int OnAttach(obj_id self) throws InterruptedException
{
setCondition(self, CONDITION_CONVERSABLE);
return SCRIPT_CONTINUE;
}
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info menuInfo) throws InterruptedException
{
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;
}
public int OnIncapacitated(obj_id self, obj_id killer) throws InterruptedException
{
clearCondition(self, CONDITION_CONVERSABLE);
detachScript(self, "npc.conversation.quharek_phase_4");
return SCRIPT_CONTINUE;
}
public boolean npcStartConversation(obj_id player, obj_id npc, String convoName, string_id greetingId, prose_package greetingProse, string_id[] responses) throws InterruptedException
{
Object[] objects = new Object[responses.length];
System.arraycopy(responses, 0, objects, 0, responses.length);
return npcStartConversation(player, npc, convoName, greetingId, greetingProse, objects);
}
public int OnStartNpcConversation(obj_id self, obj_id player) throws InterruptedException
{
if (ai_lib.isInCombat(self) || ai_lib.isInCombat(player))
{
return SCRIPT_OVERRIDE;
}
if (quharek_phase_4_condition__defaultCondition(player, self))
{
string_id message = new string_id(c_stringFile, "s_c3af3465");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (quharek_phase_4_condition__defaultCondition(player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
boolean hasResponse1 = false;
if (quharek_phase_4_condition__defaultCondition(player, self))
{
++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_30920b89");
}
if (hasResponse1)
{
responses[responseIndex++] = new string_id(c_stringFile, "s_c9211a00");
}
setObjVar(player, "conversation.quharek_phase_4.branchId", 1);
npcStartConversation(player, self, "quharek_phase_4", message, responses);
}
else
{
chat.chat(self, message);
}
return SCRIPT_CONTINUE;
}
chat.chat(self, "Error: All conditions for OnStartNpcConversation were false.");
return SCRIPT_CONTINUE;
}
public int OnNpcConversationResponse(obj_id self, String conversationId, obj_id player, string_id response) throws InterruptedException
{
if (!conversationId.equals("quharek_phase_4"))
{
return SCRIPT_CONTINUE;
}
int branchId = getIntObjVar(player, "conversation.quharek_phase_4.branchId");
if (branchId == 1 && response.equals("s_30920b89"))
{
if (quharek_phase_4_condition__defaultCondition(player, self))
{
string_id message = new string_id(c_stringFile, "s_1fcf4289");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (quharek_phase_4_condition__defaultCondition(player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
boolean hasResponse1 = false;
if (quharek_phase_4_condition__defaultCondition(player, self))
{
++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_8a61b230");
}
if (hasResponse1)
{
responses[responseIndex++] = new string_id(c_stringFile, "s_46847c8d");
}
setObjVar(player, "conversation.quharek_phase_4.branchId", 2);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
removeObjVar(player, "conversation.quharek_phase_4.branchId");
npcSpeak(player, message);
npcEndConversation(player);
}
return SCRIPT_CONTINUE;
}
chat.chat(self, "Error: All conditions for OnNpcConversationResponse for branch 'Hi. How go things?' were false.");
return SCRIPT_CONTINUE;
}
if (branchId == 1 && response.equals("s_c9211a00"))
{
if (quharek_phase_4_condition__defaultCondition(player, self))
{
string_id message = new string_id(c_stringFile, "s_55ff471a");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (quharek_phase_4_condition__defaultCondition(player, self))
{
++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_f3f4fde4");
}
setObjVar(player, "conversation.quharek_phase_4.branchId", 5);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
removeObjVar(player, "conversation.quharek_phase_4.branchId");
npcSpeak(player, message);
npcEndConversation(player);
}
return SCRIPT_CONTINUE;
}
chat.chat(self, "Error: All conditions for OnNpcConversationResponse for branch 'Hi. How go things?' were false.");
return SCRIPT_CONTINUE;
}
if (branchId == 2 && response.equals("s_8a61b230"))
{
if (quharek_phase_4_condition__defaultCondition(player, self))
{
string_id message = new string_id(c_stringFile, "s_4909db59");
removeObjVar(player, "conversation.quharek_phase_4.branchId");
npcSpeak(player, message);
npcEndConversation(player);
return SCRIPT_CONTINUE;
}
chat.chat(self, "Error: All conditions for OnNpcConversationResponse for branch 'Good! I am glad we have had some small part in your self-realization and growth. One of the greatest things a sapient can do on their path of life is to enhance the well being of other sapient beings.' were false.");
return SCRIPT_CONTINUE;
}
if (branchId == 2 && response.equals("s_46847c8d"))
{
if (quharek_phase_4_condition__defaultCondition(player, self))
{
string_id message = new string_id(c_stringFile, "s_3a5501aa");
removeObjVar(player, "conversation.quharek_phase_4.branchId");
npcSpeak(player, message);
npcEndConversation(player);
return SCRIPT_CONTINUE;
}
chat.chat(self, "Error: All conditions for OnNpcConversationResponse for branch 'Good! I am glad we have had some small part in your self-realization and growth. One of the greatest things a sapient can do on their path of life is to enhance the well being of other sapient beings.' were false.");
return SCRIPT_CONTINUE;
}
if (branchId == 5 && response.equals("s_f3f4fde4"))
{
if (quharek_phase_4_condition__defaultCondition(player, self))
{
string_id message = new string_id(c_stringFile, "s_cae55dfb");
removeObjVar(player, "conversation.quharek_phase_4.branchId");
npcSpeak(player, message);
npcEndConversation(player);
return SCRIPT_CONTINUE;
}
chat.chat(self, "Error: All conditions for OnNpcConversationResponse for branch 'No. Our new Chief engineer is handling all new crafting tasks.' were false.");
return SCRIPT_CONTINUE;
}
chat.chat(self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
removeObjVar(player, "conversation.quharek_phase_4.branchId");
return SCRIPT_CONTINUE;
}
}