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

190 lines
8.3 KiB
Java
Executable File

package script.conversation;
import script.library.ai_lib;
import script.library.chat;
import script.*;
public class village_sarguillo_2 extends script.base_script
{
public village_sarguillo_2()
{
}
public static String c_stringFile = "conversation/village_sarguillo_2";
public boolean village_sarguillo_2_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.village_sarguillo_2");
}
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.village_sarguillo_2");
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 (village_sarguillo_2_condition__defaultCondition(player, self))
{
doAnimationAction(self, "check_wrist_device");
string_id message = new string_id(c_stringFile, "s_ffe08b69");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (village_sarguillo_2_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_55d76f7");
}
setObjVar(player, "conversation.village_sarguillo_2.branchId", 1);
npcStartConversation(player, self, "village_sarguillo_2", 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("village_sarguillo_2"))
{
return SCRIPT_CONTINUE;
}
int branchId = getIntObjVar(player, "conversation.village_sarguillo_2.branchId");
if (branchId == 1 && response.equals("s_55d76f7"))
{
if (village_sarguillo_2_condition__defaultCondition(player, self))
{
doAnimationAction(self, "shake_head_no");
string_id message = new string_id(c_stringFile, "s_1cf74704");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (village_sarguillo_2_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_c96d6885");
}
setObjVar(player, "conversation.village_sarguillo_2.branchId", 2);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
removeObjVar(player, "conversation.village_sarguillo_2.branchId");
npcSpeak(player, message);
npcEndConversation(player);
}
return SCRIPT_CONTINUE;
}
chat.chat(self, "Error: All conditions for OnNpcConversationResponse for branch 'Check sector 4. The sensor array is indicating movement in that area. Probably just more brackasets.' were false.");
return SCRIPT_CONTINUE;
}
if (branchId == 2 && response.equals("s_c96d6885"))
{
if (village_sarguillo_2_condition__defaultCondition(player, self))
{
string_id message = new string_id(c_stringFile, "s_7c5b4636");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (village_sarguillo_2_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_59b666a8");
}
setObjVar(player, "conversation.village_sarguillo_2.branchId", 3);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
removeObjVar(player, "conversation.village_sarguillo_2.branchId");
npcSpeak(player, message);
npcEndConversation(player);
}
return SCRIPT_CONTINUE;
}
chat.chat(self, "Error: All conditions for OnNpcConversationResponse for branch 'No. Kind of busy here coordinating patrols. What can I do for you?' were false.");
return SCRIPT_CONTINUE;
}
if (branchId == 3 && response.equals("s_59b666a8"))
{
if (village_sarguillo_2_condition__defaultCondition(player, self))
{
string_id message = new string_id(c_stringFile, "s_ee7d6b1f");
removeObjVar(player, "conversation.village_sarguillo_2.branchId");
npcSpeak(player, message);
npcEndConversation(player);
return SCRIPT_CONTINUE;
}
chat.chat(self, "Error: All conditions for OnNpcConversationResponse for branch 'You should speak to the Elder. He can give you all the help you need.' were false.");
return SCRIPT_CONTINUE;
}
chat.chat(self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
removeObjVar(player, "conversation.village_sarguillo_2.branchId");
return SCRIPT_CONTINUE;
}
}