//#include "DIALOGS\Eugene Martin_dialog.h"

void ProcessDialogEvent()
{
	ref NPChar;
	aref Link, NextDiag;

	DeleteAttribute(&Dialog,"Links");

	makeref(NPChar,CharacterRef);
	makearef(Link, Dialog.Links);
	makearef(NextDiag, NPChar.Dialog);

	ref PChar;
	PChar = GetMainCharacter();

	
	switch(Dialog.CurrentNode)
	{
		// -----------------------------------Диалог первый - первая встреча
		case "First time":
			Dialog.defAni = "dialog_stay1";
			Dialog.defCam = "1";
			Dialog.defSnd = "dialogs\0\017";
			Dialog.defLinkAni = "dialog_1";
			Dialog.defLinkCam = "1";
			Dialog.defLinkSnd = "dialogs\woman\024";
			Dialog.ani = "dialog_stay2";
			Dialog.cam = "1";

			if (CheckAttribute(Pchar,"quest.firstwork") && PChar.quest.firstwork == "paiebarque")
			{
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[49];

        		if (makeint(pchar.money >= 35000))
			{
				link.l1 = DLG_TEXT[45];
				link.l1.go = "begin_24";
                        Pchar.quest.voyage_timer2.over = "yes";
			}
			else
			{
				link.l1 = DLG_TEXT[54];
				link.l1.go = "exit";					
			}

			}
			else
			{
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[54];
			link.l1 = DLG_TEXT[55];
			link.l1.go = "exit";			
			}

			NextDiag.TempNode = "first time";
			
		break;

                case "begin1_1":
  
                        dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[0];
			link.l1 = DLG_TEXT[1];
			link.l1.go = "begin_1";
               break;

                 
                case "begin_1":
  
                        dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[2];
			link.l1 = DLG_TEXT[3];
			link.l1.go = "begin_2";
               break;


                case "begin_2":
  
                        dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[4];
			link.l1 = DLG_TEXT[5];
			link.l1.go = "begin_3";
               break;

                case "begin_3":
  
                        dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[6];
			link.l1 = DLG_TEXT[7];
			link.l1.go = "begin_4";
               break;

                
                case "begin_4":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[8];
			link.l1 = DLG_TEXT[9];
			link.l1.go = "begin_5";
                   
		break;

                
                case "begin_5":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[10];
			link.l1 = DLG_TEXT[11];
			link.l1.go = "begin_6";
                       
		break;
                 
                case "begin_6":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[12];
			link.l1 = DLG_TEXT[13];
			link.l1.go = "begin_7";
                     
		break;
                 
                case "begin_7":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[14];
			link.l1 = DLG_TEXT[15];
			link.l1.go = "begin_8";

		break;

                case "begin_8":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[16];
			link.l1 = DLG_TEXT[17];
			link.l1.go = "begin_10";

		break;

                case "begin_10":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[18];
			link.l1 = DLG_TEXT[19];
			link.l1.go = "exit";

                       LAi_QuestDelay("voyage_timer1", 0.0);
                       AddDialogExitQuest("rencemil");

		break;

                case "begin_11":

                        if(GetSquadronGoods(pchar,GOOD_SILK)>=200)
			{
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[20];
			link.l1 = DLG_TEXT[21];
			link.l1.go = "begin_12";
			RemoveCharacterGoods(pchar, GOOD_SILK, 200);
                        Pchar.quest.voyage_timer1.over = "yes";
			}
			else
			{
				dialog.snd = "Voice\CLLA\CLLA002";
				dialog.text = DLG_TEXT[54];
				link.l1 = DLG_TEXT[55];
				link.l1.go = "exit";
			
			}

		break;

                case "begin_12":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[22];
			link.l1 = DLG_TEXT[23];
			link.l1.go = "begin_13";
                        PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneyToCharacter(pchar, 10000);

		break;

                case "begin_13":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[24];
			link.l1 = DLG_TEXT[25];
			link.l1.go = "begin_14";

		break;

                case "begin_14":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[26];
			link.l1 = DLG_TEXT[27];
			link.l1.go = "exit";
                       LAi_QuestDelay("voyage_timer3", 0.0);
                       AddDialogExitQuest("rencelias");

		break;

                case "begin_15":

                        if(GetSquadronGoods(pchar,GOOD_ALE)>=700)
			{
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[28];
			link.l1 = DLG_TEXT[29];
			link.l1.go = "begin_16";
                        Pchar.quest.voyage_timer3.over = "yes";
			RemoveCharacterGoods(pchar, GOOD_ALE, 700);
			}
			else
			{
				dialog.snd = "Voice\CLLA\CLLA002";
				dialog.text = DLG_TEXT[54];
				link.l1 = DLG_TEXT[55];
				link.l1.go = "exit";
			
			}

		break;

                case "begin_16":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[30];
			link.l1 = DLG_TEXT[31];
			link.l1.go = "begin_17";
                        PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneyToCharacter(pchar, 8000);

		break;

                case "begin_17":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[32];
			link.l1 = DLG_TEXT[33];
			link.l1.go = "begin_18";

		break;

                case "begin_18":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[34];
			link.l1 = DLG_TEXT[35];
			link.l1.go = "begin_19";

		break;

                case "begin_19":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[36];
			link.l1 = DLG_TEXT[37];
			link.l1.go = "begin_20";

		break;

                case "begin_20":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[38];
			link.l1 = DLG_TEXT[39];
			link.l1.go = "begin_21";

		break;

                case "begin_21":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[40];
			link.l1 = DLG_TEXT[41];
			link.l1.go = "exit";

                       LAi_QuestDelay("voyage_timer4", 0.0);
                       AddDialogExitQuest("rencmag");

		break;

                case "begin_22":

                        if(GetSquadronGoods(pchar,GOOD_TOBACCO)>=200)
			{
               			dialog.snd = "Voice\CLLA\CLLA004";
		        	dialog.text = DLG_TEXT[42];
			        link.l1 = DLG_TEXT[43];
			        link.l1.go = "begin_23";
                                Pchar.quest.voyage_timer4.over = "yes";
	       		        RemoveCharacterGoods(pchar, GOOD_TOBACCO, 200);
			}
			else
			{
				dialog.snd = "Voice\CLLA\CLLA002";
				dialog.text = DLG_TEXT[54];
				link.l1 = DLG_TEXT[55];
				link.l1.go = "exit";
			
			}


		break;

                case "begin_23":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[44];
                        PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneyToCharacter(pchar, 7000);

        		if (makeint(pchar.money >= 35000))
			{
				link.l1 = DLG_TEXT[45];
				link.l1.go = "begin_24";
			}
			else
			{
				link.l1 = DLG_TEXT[46];
				link.l1.go = "begin_27";
				
			}

		break;

                case "begin_24":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[50];
			link.l1 = DLG_TEXT[51];
			link.l1.go = "begin_25";
                       PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneyToCharacter(pchar, -35000);

		break;

                case "begin_25":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[52];
			link.l1 = DLG_TEXT[53];
			link.l1.go = "exit";
			pchar.quest.firstwork = "fintravail";
			pchar.quest.Meet_Emil_Fin.win_condition.l1 = "location";
			pchar.quest.Meet_Emil_Fin.win_condition.l1.location = "Buccaneers_Camp";
			pchar.quest.Meet_Emil_Fin.win_condition = "Emiliosuit";

		break;

                case "begin_27":
			dialog.snd = "Voice\CLLA\CLLA004";
			dialog.text = DLG_TEXT[47];
			link.l1 = DLG_TEXT[48];
			link.l1.go = "exit";
                       LAi_QuestDelay("voyage_timer2", 0.0);
			pchar.quest.firstwork = "paiebarque";

		break;

 
               case "Exit":

			DialogExit();
			NextDiag.CurrentNode = NextDiag.TempNode;
		

                       break;



	}
}
