void ProcessDialogEvent()
{
	ref NPChar, PChar, d; 
	PChar = GetMainCharacter();
	aref Link, Diag;
	string NPC_Meeting, TempInfoCharacterID_1, TempInfoCharacterID_2;
	int Sum;
	int tmpLangFileID = LanguageOpenFile("interface_strings.txt");
	
	DeleteAttribute(&Dialog,"Links");

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

	string iDay, iMonth;
	iDay = environment.date.day;
	iMonth = environment.date.month;
	string lastspeak_date = iday + " " + iMonth;

	int winlink;	//ccc

	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";
			Dialog.snd = "dialogs\0\009";

			if(NPchar.sex == "man") {PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_c_006.wav");}	//ccc
			else {PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_f_c_003.wav");}			//MAXIMUS: in russians sounds Dut_f_a_001.wav says 'Do you want to rent a room for the night?', but this sound says 'What can I serve for you?' or something like that

			int chance = Rand(13);
			while(CheckActiveQuest("treasure") && chance==12) chance = Rand(13);//MAXIMUS: prevents from doubled treasure-quests
			switch(chance)
			{
				case 0:
					d.Text = DLG_TEXT[0]; 
					Link.l1 = DLG_TEXT[1];
					Link.l1.go = "skeletons";
					Link.l2 = DLG_TEXT[2];
					Link.l2.go = "exit";
				break;

				case 1:
					// ccc Dec 05 You are recognized after raising pirateflag
					if(CheckAttribute(Pchar,"orgnation") && Pchar.orgnation == "traitor" && makeint(GetLocationNationFromID(NPchar.location))!=3)	// checks if you once hoisted Jolly Roger
					{
						DeleteAttribute(Pchar,"orgnation");	// so that recognizing happens only once
						d.Text = DLG_TEXT[294];
						Link.l1 = RandSwear() + DLG_TEXT[295];
						Link.l1.go = "alarm";
					}
					else
					{
					d.Text = DLG_TEXT[3];
					Link.l1 = DLG_TEXT[4];
					Link.l1.go = "police";
					Link.l2 = DLG_TEXT[5];
					Link.l2.go = "exit";
					}	// ccc hoist flag end
				break;

				case 2:
					d.Text = DLG_TEXT[6];
					Link.l1 = DLG_TEXT[7];
					Link.l1.go = "health";
					Link.l2 = DLG_TEXT[8];
					Link.l2.go = "exit";
				break;

				case 3:
					d.Text = DLG_TEXT[9];
					Link.l1 = DLG_TEXT[10];
					Link.l1.go = "tavern";
					Link.l2 = DLG_TEXT[11];
					Link.l2.go = "exit";
				break;

				case 4:
					d.Text = DLG_TEXT[12];
					Link.l1 = DLG_TEXT[13];
					Link.l1.go = "officer";
					Link.l2 = DLG_TEXT[14];
					Link.l2.go = "exit";
				break;

				case 5:
					d.Text = DLG_TEXT[15];
					Link.l1 = DLG_TEXT[16];
					Link.l1.go = "shipyard";
					Link.l2 = DLG_TEXT[17];
					Link.l2.go = "exit";
				break;

				case 6:
					d.Text = DLG_TEXT[18];
					Link.l1 = DLG_TEXT[19];
					Link.l1.go = "torg";
					Link.l2 = DLG_TEXT[20];
					Link.l2.go = "exit_once_more";
				break;

				case 7:
					d.Text = DLG_TEXT[21];
					Link.l1 = DLG_TEXT[22];
					Link.l1.go = "healing";
					Link.l2 = DLG_TEXT[23];
					Link.l2.go = "exit_once_more_portion";
				break;

				case 8:
					d.Text = DLG_TEXT[24];
					Link.l1 = DLG_TEXT[25];
					Link.l1.go = "reput";
					Link.l2 = DLG_TEXT[26];
					Link.l2.go = "exit_out";
				break;

				case 9:
					if (1 < Rand(20))
					{
						switch(Rand(1))
						{
							case 0:
								d.Text = DLG_TEXT[27];
								Link.l1 = DLG_TEXT[28];
								Link.l1.go = "beg";
								Link.l2 = DLG_TEXT[29];
								Link.l2.go = "exit_out";
							break;

							case 1:
								d.Text = DLG_TEXT[30];
								Link.l1 = DLG_TEXT[31];
								Link.l1.go = "beg";
								Link.l2 = DLG_TEXT[32];
								Link.l2.go = "exit_out";
							break;
						}
					}
					else
					{
						d.Text = DLG_TEXT[33];
						Link.l1 = DLG_TEXT[34];
						Link.l1.go = "skill";
						Link.l2 = DLG_TEXT[35];
						Link.l2.go = "exit_out";
					}
				break;
				
				case 10:
					// NK increase skillmaster to 5% of the time-->
					if (11 < Rand(19))
					{
						d.Text = DLG_TEXT[36];
						Link.l1 = DLG_TEXT[37];
						Link.l1.go = "enlist_me";
						Link.l2 = DLG_TEXT[38];
						Link.l2.go = "exit_out";
					}
					else
					{
						d.Text = DLG_TEXT[33];
						Link.l1 = DLG_TEXT[34];
						Link.l1.go = "skill";
						Link.l2 = DLG_TEXT[35];
						Link.l2.go = "exit_out";
					}
					// NK <--
				break;

				case 11:
					d.Text = DLG_TEXT[39];
					Link.l1 = DLG_TEXT[40];
					Link.l1.go = "masters";
					Link.l2 = DLG_TEXT[41];
					Link.l2.go = "exit";
				break;

				case 12:
					d.text = DLG_TEXT[279];
					link.l1 = DLG_TEXT[280];
					link.l1.go = "why";
					link.l2 = DLG_TEXT[281];
					link.l2.go = "exit_out";
				break;

				// TIH --> highquality item seller Jul29'06
				case 13:
					// further reduce the chance of these people
					if(rand(100)<80) {
						d.Text = DLG_TEXT[297];
						Link.l1 = DLG_TEXT[298];
						Link.l1.go = "hqitemseller_look";
						Link.l2 = DLG_TEXT[299];
						Link.l2.go = "hqitemseller_exit";
					} else {
						d.Text = DLG_TEXT[14];
						Link.l1 = DLG_TEXT[304];
						Link.l1.go = "hqitemseller_busy";
					}
				break;
				// TIH <--
			}
			//ccc CR apr01 ->
			if(COASTRAIDER_CHANCE > 0 && AUTOCREATE_CR == 0)		
			{
				if(rand(100)<30)
				{
					Link.l3 = LinkRandPhrase(DLG_TEXT[270], DLG_TEXT[271], DLG_TEXT[272]);
					Link.l3.go = "coastraiders";
				}
				else
				{
					Link.l3 = LinkRandPhrase(DLG_TEXT[270], DLG_TEXT[271], DLG_TEXT[272]);
					Link.l3.go = "NOraiders";
				}
			}
			//ccc CR apr01 <-
		break;

		// ccc CR ->
		case "coastraiders":
			d.text = LinkRandPhrase(DLG_TEXT[273], DLG_TEXT[274], DLG_TEXT[275]);
			link.l1 = LinkRandPhrase(DLG_TEXT[276], DLG_TEXT[277], DLG_TEXT[278]);
			link.l1.go = "exit";
			string islandstr = Islands[GetCharacterCurrentIsland(Pchar)].id;
			SetCoastTraffic(islandstr);
			if(NPchar.sex == "man") {PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_c_068.wav");}
			else {PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_f_c_003.wav");}			//MAXIMUS: in russians sounds Dut_f_a_001.wav says 'Do you want to rent a room for the night?', but this sound says 'What can I serve for you?' or something like that
		break;

		case "NOraiders":
			d.text = DLG_TEXT[230];
			link.l1 = LinkRandPhrase(DLG_TEXT[276], DLG_TEXT[277], DLG_TEXT[278]);
			link.l1.go = "exit";
		break;
		// ccc CR <-

		case "skeletons":
			d.Text = DLG_TEXT[42];
			Link.l1 = DLG_TEXT[43];
			Link.l1.go = "exit";
		break;

		case "police":
			d.Text = DLG_TEXT[44];
			Link.l1 = DLG_TEXT[45];
			Link.l1.go = "police1";
			Link.l2 = DLG_TEXT[46];
			Link.l2.go = "exit";
		break;

		case "police1":
			d.Text = DLG_TEXT[47];
			Link.l1 = DLG_TEXT[48];
			Link.l1.go = "exit";
		break;

		case "health":
			d.Text = DLG_TEXT[49];
			Link.l1 = DLG_TEXT[50];
			Link.l1.go = "health1";
			Link.l2 = DLG_TEXT[51];
			Link.l2.go = "exit";
		break;

		case "health1":
			d.Text = DLG_TEXT[52];
			Link.l1 = DLG_TEXT[53];
			Link.l1.go = "exit";
		break;

		case "tavern":
			d.Text = DLG_TEXT[54];
			Link.l1 = DLG_TEXT[55];
			Link.l1.go = "exit";
		break;

		case "officer":
			d.Text = DLG_TEXT[56];
			Link.l1 = DLG_TEXT[57];
			Link.l1.go = "exit";
		break;

		case "shipyard":
			d.Text = DLG_TEXT[58];
			Link.l1 = DLG_TEXT[59];
			Link.l1.go = "exit";
		break;

		case "masters":
			d.Text = DLG_TEXT[60];
			Link.l1 = DLG_TEXT[61];
			Link.l1.go = "exit";
		break;

		case "torg":
			NPChar.itemtrade.tradetype = IT_TYPE_SNEAKY; // TIH properly set the trader type

			if (npchar.quest.Meeting != lastspeak_date)
			{
				GiveItemToTrader(npchar);
				npchar.quest.Meeting = lastspeak_date;
			}

			Diag.CurrentNode = "once_more";
			DialogExit();

			LaunchItemsTrade(NPChar);
		break;

		// TIH --> high quality item seller Jul29'06
		// sells one (maybe two) very high quality items to the player
		// will not BUY anything, and will not talk to the player again about it
		// do not use minlevel as this is already a rare encounter for the player
		case "hqitemseller_look":
			NPChar.itemtrade.tradetype = IT_TYPE_SNEAKY;

			bool 	gotItem = false;
			bool 	noMore 	= false;
			ref 	itm;
			string	itmid;
			int		randomIdx = 0;
			int		validItemIdxsCount = 0;
			int		validItemIdxs[MAX_ITEMS];
			int 	i;

			// loop though and find only the BEST items
			for(i = FIRST_TRADE_ITEM; i < ITEMS_QUANTITY; i++) {
				makeref(itm, Items[i]);

				// this set allows them to get 'excellent' quality weapons to sell
				if ( sti(itm.skipsell) && !CheckAttribute(itm,"BladeQuality") && !CheckAttribute(itm,"GunQuality") ) continue;
				if ( CheckAttribute(itm,"BladeQuality") && itm.BladeQuality < 3 ) continue;
				if ( CheckAttribute(itm,"GunQuality") && itm.GunQuality < 3 ) continue;

				if ( CheckAttribute(itm,"price") 	&& sti(itm.price) < 500 ) 	continue;
				if ( CheckAttribute(itm,"minlevel") && sti(itm.minlevel) < 5 ) 	continue;
				if ( CheckAttribute(itm,"quality") 	&& sti(itm.quality) < 7 ) 	continue;

				validItemIdxs[validItemIdxsCount] = i;
				validItemIdxsCount++;
			}

			// now possibly add more than one item for sell
			while ( !gotItem ) {
				randomIdx = validItemIdxs[rand(validItemIdxsCount-1)];
				makeref(itm, Items[randomIdx]);
				TakeNItems(&NPChar, itm.id, 1);// only one per item
				// add some special info for this, as it wont show up for trade otherwise
				itmid = itm.id;
				NPChar.itemtrade.rareseller = true;
				NPChar.itemtrade.itemlist.items.(itmid).qty 	= 1.0;	// premium
				NPChar.itemtrade.itemlist.items.(itmid).price 	= 1.25;	// premium
				NPChar.itemtrade.itemlist.items.(itmid).quality = 10;	// premium
				NPChar.itemtrade.itemlist.items.(itmid).fprice 	= 1.25;	// premium
				// 50% chance to try to add a second item
				if ( (rand(100)<50) || noMore ) gotItem = true;// we will only do one
				else 							noMore 	= true;// we continue to one more item
			}

			Diag.CurrentNode = "hqitemseller_nomore";
			DialogExit();
			LaunchItemsTrade(NPChar);
		break;
		case "hqitemseller_nomore":
			if (PChar.sex == "woman") 	d.Text = DLG_TEXT[300] + DLG_TEXT[302] + DLG_TEXT[303];
			else 						d.Text = DLG_TEXT[300] + DLG_TEXT[301] + DLG_TEXT[303];
			Link.l1 = DLG_TEXT[304];
			Link.l1.go = "hqitemseller_exit";
		break;
		case "hqitemseller_exit":
			Diag.CurrentNode = "hqitemseller_nomore";
			DialogExit();
		break;
		case "hqitemseller_busy":
			Diag.CurrentNode = "First time";// so if you talk to them again, it chooses a different approach
			DialogExit();
		break;
		// TIH <--

		case "healing":
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneytoCharacter(Pchar, -200);
			LAi_SetCurHP(pchar, LAi_GetCharacterMaxHP(pchar));
			Diag.CurrentNode = "once_more_portion";
			DialogExit();
		break;

		case "healing1":
			LAi_SetCurHP(pchar, LAi_GetCharacterMaxHP(pchar));
			Diag.CurrentNode = "thanx";
			DialogExit();
		break;

		case "reput":
			d.Text = DLG_TEXT[62];
			Link.l1 = DLG_TEXT[63];
			Link.l1.go = "exit_out";
			Link.l2 = DLG_TEXT[64];
			Link.l2.go = "exit1";
		break;

		case "beg":
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneyToCharacter(pchar, -10);
			switch (Rand(2))
			{
					case 0:
						d.Text = DLG_TEXT[65];
						Link.l1 = DLG_TEXT[66];
						Link.l1.go = "healing1";
					break;

					case 1:
						d.Text = DLG_TEXT[67];
						Link.l1 = DLG_TEXT[68];
						Link.l1.go = "item";
					break;

					case 2:
						d.Text = DLG_TEXT[69];
						Link.l1 = DLG_TEXT[70];
						Link.l1.go = "exit_than";
					break;
			}
		break;

		case "item":
			int ranpick = 1 + Rand(15);// 1 to 16
			GiveItem2Character(pchar, "indian"+ranpick);
			Diag.CurrentNode = "thanx";
			DialogExit();
		break;

		case "enlist_me":
			NPChar.Dialog.Filename = "Enc_Officer_dialog.c";
			d.Text = DLG_TEXT[292];
			Link.l1 = DLG_TEXT[293];
			Link.l1.go = "exit_change_dlg";
			NPChar.offgen = true;
			NPChar.officer = true;
// MAXIMUS interface MOD -->
			switch(Rand(7))
			{
				case 0: NPChar.quest.officertype = OFFIC_TYPE_BOATSWAIN; break;
				case 1: NPChar.quest.officertype = OFFIC_TYPE_CANNONEER; break;
				case 2: NPChar.quest.officertype = OFFIC_TYPE_QMASTER; break;
				case 3: NPChar.quest.officertype = OFFIC_TYPE_NAVIGATOR; break;
				case 4: NPChar.quest.officertype = OFFIC_TYPE_FIRSTMATE; break;
// MAXIMUS officers -->
				case 5: NPChar.quest.officertype = OFFIC_TYPE_CARPENTER; break;
				case 6: NPChar.quest.officertype = OFFIC_TYPE_DOCTOR; break;
				case 7: NPChar.quest.officertype = OFFIC_TYPE_ABORDAGE; break;
// MAXIMUS officers <--
			}
			LAi_Create_Officer(rand(8), &NPChar); //so that these officers are better than tavern ones.
			PChar.newofficerid = NPchar.id;//MAXIMUS
// MAXIMUS interface MOD <--
			
		break;
		
		case "enlist_me1":
			SetOfficersIndex(Pchar, -1, NPChar);
			LAi_SetOfficerType(NPChar);
			Diag.CurrentNode = "got_officer";
			DialogExit();
		break;

		case "skill":
			switch (Rand(7))
			{
				case 0:
					d.Text = DLG_TEXT[74];
					if(makeint(PChar.skill.Fencing)>9)
					{
						Link.l1 = DLG_TEXT[75];
						Link.l1.go = "exit_Fencing";
					}
					else
					{
						Link.l1 = DLG_TEXT[76];
						Link.l1.go = "Fencing";
					}
					if(makeint(PChar.skill.Defence)>9)
					{
						Link.l1 = DLG_TEXT[77];
						Link.l1.go = "exit_out";
					}
					else
					{
						Link.l2 = DLG_TEXT[78];
						Link.l2.go = "Defence";
					}
					Link.l3 = DLG_TEXT[79];
					Link.l3.go = "exit_Fencing";
				break;

				case 1:
					d.Text = DLG_TEXT[80];
					if(makeint(PChar.skill.Leadership)>9)
					{
						Link.l1 = DLG_TEXT[81];
						Link.l1.go = "exit_out";
					}
					else
					{
						Link.l1 = DLG_TEXT[82];
						Link.l1.go = "Leadership";
					}
					Link.l2 = DLG_TEXT[83];
					Link.l2.go = "exit_Leadership";
				break;

				case 2:
					d.Text = DLG_TEXT[84];
					if(makeint(PChar.skill.Sailing)>9)
					{
						Link.l1 = DLG_TEXT[85];
						Link.l1.go = "exit_out";
					}
					else
					{
						Link.l1 = DLG_TEXT[86];
						Link.l1.go = "Sailing";
					}
					Link.l2 = DLG_TEXT[87];
					Link.l2.go = "exit_Sailing";
				break;

				case 3:
					d.Text = DLG_TEXT[88];
					if(makeint(PChar.skill.Accuracy)>9)
					{
						Link.l1 = DLG_TEXT[89];
						Link.l1.go = "exit_out";
					}
					else
					{
						Link.l1 = DLG_TEXT[90];
						Link.l1.go = "Accuracy";
					}
					Link.l2 = DLG_TEXT[91];
					Link.l2.go = "exit_Accuracy";
				break;

				case 4:
					d.Text = DLG_TEXT[92];
					if(makeint(PChar.skill.Cannons)>9)
					{
						Link.l1 = DLG_TEXT[93];
						Link.l1.go = "exit_out";
					}
					else
					{
						Link.l1 = DLG_TEXT[94];
						Link.l1.go = "Cannons";

					}
					Link.l2 = DLG_TEXT[95];
					Link.l2.go = "exit_Cannons";
				break;

				case 5:
					d.Text = DLG_TEXT[96];
					if(makeint(PChar.skill.Grappling)>9)
					{
						Link.l1 = DLG_TEXT[97];
						Link.l1.go = "exit_out";
					}
					else
					{
						Link.l1 = DLG_TEXT[98];
						Link.l1.go = "Grappling";
					}
					Link.l2 = DLG_TEXT[99];
					Link.l2.go = "exit_Grappling";
				break;

				case 6:
					d.Text = DLG_TEXT[100];
					if(makeint(PChar.skill.Repair)>9)
					{
						Link.l1 = DLG_TEXT[101];
						Link.l1.go = "exit_out";
					}
					else
					{
						Link.l1 = DLG_TEXT[102];
						Link.l1.go = "Repair";
					}
					Link.l2 = DLG_TEXT[103];
					Link.l2.go = "exit_Repair";
				break;
	
				case 7:
					d.Text = DLG_TEXT[104];
					if(makeint(PChar.skill.Commerce)>9)
					{
						Link.l1 = DLG_TEXT[105];
						Link.l1.go = "exit_out";
					}
					else
					{
						Link.l1 = DLG_TEXT[106];
						Link.l1.go = "Commerce";
					}
					Link.l2 = DLG_TEXT[107];
					Link.l2.go = "exit_Commerce";
				break;
			}
		break;

		case "Fencing":
			Sum = (sti(Pchar.skill.Fencing) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[108] + Sum + DLG_TEXT[109];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[110];
				Link.l1.go = "exit_Fencing";		
			}
			else
			{
				Link.l1 = DLG_TEXT[111];
				Link.l1.go = "Fencing1";
				Link.l2 = DLG_TEXT[112];
				Link.l2.go = "exit_Fencing";
			}
		break;

		case "Fencing2":
			Sum = (sti(Pchar.skill.Fencing) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[113] + Sum + DLG_TEXT[114];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[115];
				Link.l1.go = "exit_Fencing";		
			}
			else
			{
				Link.l1 = DLG_TEXT[116];
				Link.l1.go = "Fencing1";
				Link.l2 = DLG_TEXT[117];
				Link.l2.go = "exit_Fencing";
			}
		break;

		case "Fencing1":
			Sum = (sti(Pchar.skill.Fencing) + 1) * 1000;	//ccc from 10000
			if(AUTO_SKILL_SYSTEM) { AddCharacterExpNSChar(GetMainCharacter(), "Fencing", Rand(sti(Pchar.skill.Fencing)+1)*5000); }// MAXIMUS - new skillup system
			else { Pchar.skill.Fencing = makeint(Pchar.skill.Fencing) + 1; }
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneytoCharacter(Pchar, -Sum);
			GotSkill("fencing"); // ccc apr11
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "Defence":
			Sum = (sti(Pchar.skill.Defence) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[118] + Sum + DLG_TEXT[119];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[120];
				Link.l1.go = "exit_Defence";		
			}
			else
			{
				Link.l1 = DLG_TEXT[121];
				Link.l1.go = "Defence1";
				Link.l2 = DLG_TEXT[122];
				Link.l2.go = "exit_Defence";
			}
		break;

		case "Defence2":
			Sum = (sti(Pchar.skill.Defence) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[123] + Sum + DLG_TEXT[124];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[125];
				Link.l1.go = "exit_Defence";		
			}
			else
			{
				Link.l1 = DLG_TEXT[126];
				Link.l1.go = "Defence1";
				Link.l2 = DLG_TEXT[127];
				Link.l2.go = "exit_Defence";
			}
		break;

		case "Defence1":
			Sum = (sti(Pchar.skill.Defence) + 1) * 1000;	//ccc from 10000
			if(AUTO_SKILL_SYSTEM) { AddCharacterExpNSChar(GetMainCharacter(), "Defence", Rand(sti(Pchar.skill.Defence)+1)*5000); }// MAXIMUS - new skillup system
			else { Pchar.skill.Defence = makeint(Pchar.skill.Defence) + 1; }
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneytoCharacter(Pchar, -Sum);
			GotSkill("Defence"); // ccc apr11
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "Leadership":
			Sum = (sti(Pchar.skill.Leadership) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[128] + Sum + DLG_TEXT[129];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[130];
				Link.l1.go = "exit_Leadership";		
			}
			else
			{
				Link.l1 = DLG_TEXT[131];
				Link.l1.go = "Leadership1";
				Link.l2 = DLG_TEXT[132];
				Link.l2.go = "exit_Leadership";
			}
		break;

		case "Leadership2":
			Sum = (sti(Pchar.skill.Leadership) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[133] + Sum + DLG_TEXT[134];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[135];
				Link.l1.go = "exit_Leadership";		
			}
			else
			{
				Link.l1 = DLG_TEXT[136];
				Link.l1.go = "Leadership1";
				Link.l2 = DLG_TEXT[137];
				Link.l2.go = "exit_Leadership";
			}
		break;

		case "Leadership1":
			Sum = (sti(Pchar.skill.Leadership) + 1) * 1000;	//ccc from 10000
			if(AUTO_SKILL_SYSTEM) { AddCharacterExpNSChar(GetMainCharacter(), "Leadership", Rand(sti(Pchar.skill.Leadership)+1)*5000); }// MAXIMUS - new skillup system
			else { Pchar.skill.Leadership = makeint(Pchar.skill.Leadership) + 1; }
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneytoCharacter(Pchar, -Sum);
			GotSkill("leadership"); // ccc apr11
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "Sailing":
			Sum = (sti(Pchar.skill.Sailing) + 1) * 1000;		//ccc from 10000
			d.Text = DLG_TEXT[138] + Sum + DLG_TEXT[139];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[140];
				Link.l1.go = "exit_Sailing";		
			}
			else
			{
				Link.l1 = DLG_TEXT[141];
				Link.l1.go = "Sailing1";
				Link.l2 = DLG_TEXT[142];
				Link.l2.go = "exit_Sailing";
			}
		break;

		case "Sailing2":
			Sum = (sti(Pchar.skill.Sailing) + 1) * 1000;		//ccc from 10000
			d.Text = DLG_TEXT[143] + Sum + DLG_TEXT[144];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[145];
				Link.l1.go = "exit_Sailing";		
			}
			else
			{
				Link.l1 = DLG_TEXT[146];
				Link.l1.go = "Sailing1";
				Link.l2 = DLG_TEXT[147];
				Link.l2.go = "exit_Sailing";
			}
		break;

		case "Sailing1":
			Sum = (sti(Pchar.skill.Sailing) + 1) * 1000;		//ccc from 10000
			if(AUTO_SKILL_SYSTEM) { AddCharacterExpNSChar(GetMainCharacter(), "Sailing", Rand(sti(Pchar.skill.Sailing)+1)*5000); }// MAXIMUS - new skillup system
			else { Pchar.skill.Sailing = makeint(Pchar.skill.Sailing) + 1; }
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneytoCharacter(Pchar, - Sum);
			GotSkill("sailing"); // ccc apr11
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "Accuracy":
			Sum = (sti(Pchar.skill.Accuracy) + 1) * 1000;		//ccc from 10000
			d.Text = DLG_TEXT[148] + Sum + DLG_TEXT[149];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[150];
				Link.l1.go = "exit_Accuracy";		
			}
			else
			{
				Link.l1 = DLG_TEXT[151];
				Link.l1.go = "Accuracy1";
				Link.l2 = DLG_TEXT[152];
				Link.l2.go = "exit_Accuracy";
			}
		break;

		case "Accuracy2":
			Sum = (sti(Pchar.skill.Accuracy) + 1) * 1000;		//ccc from 10000
			d.Text = DLG_TEXT[153] + Sum + DLG_TEXT[154];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[155];
				Link.l1.go = "exit_Accuracy";		
			}
			else
			{
				Link.l1 = DLG_TEXT[156];
				Link.l1.go = "Accuracy1";
				Link.l2 = DLG_TEXT[157];
				Link.l2.go = "exit_Accuracy";
			}
		break;

		case "Accuracy1":
			Sum = (sti(Pchar.skill.Accuracy) + 1) * 1000;	//ccc from 10000
			if(AUTO_SKILL_SYSTEM) { AddCharacterExpNSChar(GetMainCharacter(), "Accuracy", Rand(sti(Pchar.skill.Accuracy)+1)*5000); }// MAXIMUS - new skillup system
			else { Pchar.skill.Accuracy = makeint(Pchar.skill.Accuracy) + 1; }
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneytoCharacter(Pchar, -Sum);
			GotSkill("accuracy"); // ccc apr11
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "Cannons":
			Sum = (sti(Pchar.skill.Cannons) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[158] + Sum + DLG_TEXT[159];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[160];
				Link.l1.go = "exit_Cannons";		
			}
			else
			{
				Link.l1 = DLG_TEXT[161];
				Link.l1.go = "Cannons1";
				Link.l2 = DLG_TEXT[162];
				Link.l2.go = "exit_Cannons";
			}
		break;

		case "Cannons2":
			Sum = (sti(Pchar.skill.Cannons) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[163] + Sum + DLG_TEXT[164];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[165];
				Link.l1.go = "exit_Cannons";		
			}
			else
			{
				Link.l1 = DLG_TEXT[166];
				Link.l1.go = "Cannons1";
				Link.l2 = DLG_TEXT[167];
				Link.l2.go = "exit_Cannons";
			}
		break;

		case "Cannons1":
			Sum = (sti(Pchar.skill.Cannons) + 1) * 1000;	//ccc from 10000
			if(AUTO_SKILL_SYSTEM) { AddCharacterExpNSChar(GetMainCharacter(), "Cannons", Rand(sti(Pchar.skill.Cannons)+1)*5000); }// MAXIMUS - new skillup system
			else { Pchar.skill.Cannons = makeint(Pchar.skill.Cannons) + 1; }
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneytoCharacter(Pchar, -Sum);
			GotSkill("gunnery"); // ccc apr11
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "Grappling":
			Sum = (sti(Pchar.skill.Grappling) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[168] + Sum + DLG_TEXT[169];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[170];
				Link.l1.go = "exit_Grappling";		
			}
			else
			{
				Link.l1 = DLG_TEXT[171];
				Link.l1.go = "Grappling1";
				Link.l2 = DLG_TEXT[172];
				Link.l2.go = "exit_Grappling";
			}
		break;

		case "Grappling2":
			Sum = (sti(Pchar.skill.Grappling) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[173] + Sum + DLG_TEXT[174];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[175];
				Link.l1.go = "exit_Grappling";		
			}
			else
			{
				Link.l1 = DLG_TEXT[176];
				Link.l1.go = "Grappling1";
				Link.l2 = DLG_TEXT[177];
				Link.l2.go = "exit_Grappling";
			}
		break;

		case "Grappling1":
			Sum = (sti(Pchar.skill.Grappling) + 1) * 1000;	//ccc from 10000
			if(AUTO_SKILL_SYSTEM) { AddCharacterExpNSChar(GetMainCharacter(), "Grappling", Rand(sti(Pchar.skill.Grappling)+1)*5000); }// MAXIMUS - new skillup system
			else { Pchar.skill.Grappling = makeint(Pchar.skill.Grappling) + 1; }
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneytoCharacter(Pchar, -Sum);
			GotSkill("grappling"); // ccc apr11
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "Repair":
			Sum = (sti(Pchar.skill.Repair) + 1) * 1000;		//ccc from 10000
			d.Text = DLG_TEXT[178] + Sum + DLG_TEXT[179];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[180];
				Link.l1.go = "exit_Repair";		
			}
			else
			{
				Link.l1 = DLG_TEXT[181];
				Link.l1.go = "Repair1";
				Link.l2 = DLG_TEXT[182];
				Link.l2.go = "exit_Repair";
			}
		break;

		case "Repair2":
			Sum = (sti(Pchar.skill.Repair) + 1) * 1000;		//ccc from 10000
			d.Text = DLG_TEXT[183] + Sum + DLG_TEXT[184];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[185];
				Link.l1.go = "exit_Repair";		
			}
			else
			{
				Link.l1 = DLG_TEXT[186];
				Link.l1.go = "Repair1";
				Link.l2 = DLG_TEXT[187];
				Link.l2.go = "exit_Repair";
			}
		break;

		case "Repair1":
			Sum = (sti(Pchar.skill.Repair) + 1) * 1000;		//ccc from 10000
			if(AUTO_SKILL_SYSTEM) { AddCharacterExpNSChar(GetMainCharacter(), "Repair", Rand(sti(Pchar.skill.Repair)+1)*5000); }// MAXIMUS - new skillup system
			else { Pchar.skill.Repair = makeint(Pchar.skill.Repair) + 1; }
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneytoCharacter(Pchar, -Sum);
			GotSkill("repair"); // ccc apr11
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "Commerce":
			Sum = (sti(Pchar.skill.Commerce) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[188] + Sum + DLG_TEXT[189];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[190];
				Link.l1.go = "exit_Commerce";		
			}
			else
			{
				Link.l1 = DLG_TEXT[191];
				Link.l1.go = "Commerce1";
				Link.l2 = DLG_TEXT[192];
				Link.l2.go = "exit_Commerce";
			}
		break;

		case "Commerce2":
			Sum = (sti(Pchar.skill.Commerce) + 1) * 1000;	//ccc from 10000
			d.Text = DLG_TEXT[193] + Sum + DLG_TEXT[194];
			if(makeint(Pchar.money) < Sum)
			{
				Link.l1 = DLG_TEXT[195];
				Link.l1.go = "exit_Commerce";		
			}
			else
			{
				Link.l1 = DLG_TEXT[196];
				Link.l1.go = "Commerce1";
				Link.l2 = DLG_TEXT[197];
				Link.l2.go = "exit_Commerce";
			}
		break;

		case "Commerce1":
			Sum = (sti(Pchar.skill.Commerce) + 1) * 1000;	//ccc from 10000
			if(AUTO_SKILL_SYSTEM) { AddCharacterExpNSChar(GetMainCharacter(), "Commerce", Rand(sti(Pchar.skill.Commerce)+1)*5000); }// MAXIMUS - new skillup system
			else { Pchar.skill.Commerce = makeint(Pchar.skill.Commerce) + 1; }
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneytoCharacter(Pchar, -Sum);
			GotSkill("commerce"); // ccc apr11
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "thanx":
			if(NPchar.sex == "man") {PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_007.wav");}	
			else{PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_f_c_007.wav");}
			d.Text = DLG_TEXT[198];
			Link.l1 = DLG_TEXT[199];
			Link.l1.go = "exit_than";
		break;

		case "once_more_portion":
			d.Text = DLG_TEXT[200];
			Link.l1 = DLG_TEXT[201];
			Link.l1.go = "healing";
			Link.l2 = DLG_TEXT[202];
			Link.l2.go = "exit_once_more_portion";
		break;

		case "once_more":
			d.Text = DLG_TEXT[203];
			Link.l1 = DLG_TEXT[204];
			Link.l1.go = "torg";
			Link.l2 = DLG_TEXT[205];
			Link.l2.go = "exit_once_more";
		break;

		case "get_out":
			if(NPchar.sex == "man") {PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_c_022.wav");}	//ccc
			d.Text = DLG_TEXT[206];
			Link.l2 = DLG_TEXT[207];
			Link.l2.go = "exit_out";
		break;

		case "got_officer":
			d.Text = DLG_TEXT[208];
			Link.l2 = DLG_TEXT[209];
			Link.l2.go = "exit_off";
		break;

		case "sovet":
			d.Text = DLG_TEXT[210];
			Link.l1 = DLG_TEXT[211];
			Link.l1.go = "advises";
			Link.l2 = DLG_TEXT[212];
			Link.l2.go = "exit";
		break;

		case "advises":
			switch(Rand(6))
			{	
				case 0:
					d.Text = DLG_TEXT[213];
					Link.l1 = DLG_TEXT[214];
					Link.l1.go = "exit";
				break;

				case 1:
					d.Text = DLG_TEXT[215];
					Link.l1 = DLG_TEXT[216];
					Link.l1.go = "police1";
					Link.l2 = DLG_TEXT[217];
					Link.l2.go = "exit";
				break;

				case 2:
					d.Text = DLG_TEXT[218];
					Link.l1 = DLG_TEXT[219];
					Link.l1.go = "health1";
					Link.l2 = DLG_TEXT[220];
					Link.l2.go = "exit";
				break;

				case 3:
					d.Text = DLG_TEXT[221];
					Link.l1 = DLG_TEXT[222];
					Link.l1.go = "exit";
				break;

				case 4:
					d.Text = DLG_TEXT[223];
					Link.l1 = DLG_TEXT[224];
					Link.l1.go = "exit";
				break;

				case 5:
					d.Text = DLG_TEXT[225];
					Link.l1 = DLG_TEXT[226];
					Link.l1.go = "exit";
				break;

				case 6:
					d.Text = DLG_TEXT[227];
					Link.l1 = DLG_TEXT[228];
					Link.l1.go = "exit";
				break;
			}
		break;

		//ccc pickpocket ->
		case "pursegot":
			d.Text = DLG_TEXT[263];
			Link.l1 = DLG_TEXT[264];
			Link.l1.go = "exit_out";
			Link.l2 = DLG_TEXT[265];
			Link.l2.go = "open";
		break;

		case "open":
			switch(Rand(2))
			{	
			    ref mc = GetMainCharacter();
				case 0:
				Diag.CurrentNode = "get_out";
				DialogExit();
				PlaySound("INTERFACE\took_item.wav");
				int win=100+rand(3000); 
				AddMoneyToCharacter(pchar, win);
				Log_SetStringToLog(LanguageConvertString(tmpLangFileID,"You got") + " " + win + " " + LanguageConvertString(tmpLangFileID,"gold."));
				if(AUTO_SKILL_SYSTEM) { AddPartyExpChar(pchar, "Sneak", makeint(win/4)); }
				else { AddPartyExp(pchar, win/4); }
				break;

				case 1:
				Diag.CurrentNode = "get_out";
				DialogExit();
				LAi_QuestDelay("God_hit_us", 0.1);
				PlaySound("OBJECTS\SHIPCHARGE\cannon_fire3.wav");
				if(mc.sex == "woman") PlaySound("OBJECTS\VOICES\DEAD\female\dead_wom4.wav");
				else PlaySound("OBJECTS\VOICES\DEAD\male\dead6.wav");
				Log_SetStringToLog(LanguageConvertString(tmpLangFileID,"Boobytrapped") + "!");
				LAi_ApplyCharacterDamage(PChar, 10);
				if(AUTO_SKILL_SYSTEM) { AddPartyExpChar(pchar, "Sneak", 1500); }
				else { AddPartyExp(pchar, 1500); }
				if(sti(LAi_GetCharacterHP(PChar))<20) Lai_KillCharacter(PChar);
				break;

				case 2:
				Diag.CurrentNode = "get_out";
				DialogExit();
				pchar.chr_ai.poison = 20+rand(50-sti(PChar.skill.Sneak)-sti(PChar.skill.defence) );
				PlaySound("OBJECTS\DUEL\man_hit6.wav");
				Log_SetStringToLog(XI_ConvertString("Poisoned") + "!");
				break;
			}
		break;

		case "alarm":
			if(NPchar.sex == "man") {PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_067.wav");}	
			else{PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_f_c_016.wav");}
			PlaySound("AMBIENT\TOWN\Alarm.wav");//MAXIMUS: town's alarm-bell
			LAi_group_SetRelation(LAI_DEFAULT_GROUP, LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
			LAi_group_SetRelation(LAI_GROUP_GUARDS, LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
			LAi_group_SetRelation(GetCurrentCitizenGroup(), LAI_GROUP_PLAYER, LAI_GROUP_ENEMY); // ccc Dec 05 alerts locals
			Ambush("guards", 4, "enemy", "friend",""); // 4 cops attack you

			ChangeCharacterReputation(pchar, -3);
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "stolen":
			if(NPchar.sex == "man") {PlaySound("VOICE\" + LanguageGetLanguage() + "\Dut_m_a_059.wav");}	
			else{PlaySound("VOICE\" + LanguageGetLanguage() + "\Fre_f_a_013.wav");}			
			d.text = LinkRandPhrase(DLG_TEXT[231], DLG_TEXT[232], DLG_TEXT[233]);
			int FakeMoney = sti(NPChar.money) - sti(Rand(200)+100);
			Preprocessor_Add("money", FakeMoney); // KK
			winlink=rand(100); 
			if(winlink>=50) 
			{
				Link.l1 = LinkRandPhrase(DLG_TEXT[237], DLG_TEXT[238], DLG_TEXT[239]);
				if(rand(100)+sti(pchar.skill.Sneak)>25) {Link.l1.go = "moneyback";}
				else{Link.l1.go = "nomoney";}
			}
			Link.l2 = LinkRandPhrase(DLG_TEXT[234], DLG_TEXT[235], DLG_TEXT[236]);
			if(rand(100)+sti(pchar.skill.Sneak)>80) {Link.l2.go = "moneydouble";}
			else{Link.l2.go = "nomoney";}

			Link.l3 = LinkRandPhrase(DLG_TEXT[240], DLG_TEXT[241], DLG_TEXT[242]);
			if(rand(100)+sti(pchar.skill.leadership)>35) {Link.l3.go = "moneydouble";}
			else{Link.l3.go = "nomoney";}

			if(winlink<50) 
			{
				Link.l4 = LinkRandPhrase(DLG_TEXT[237], DLG_TEXT[238], DLG_TEXT[239]);
				if(rand(100)+sti(pchar.skill.Sneak)>=30) {Link.l4.go = "moneyback";}
				else{Link.l4.go = "nomoney";}
			}
		break;

		case "nomoney":
			if(NPchar.sex == "man") {PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_012.wav");}	
			else{PlaySound("VOICE\" + LanguageGetLanguage() + "\Dut_f_a_006.wav");}			
			d.Text = DLG_TEXT[243];
			Link.l2 = DLG_TEXT[244];
			Link.l2.go = "exit_out";
		break;

		case "moneydouble":
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneyToCharacter(pchar, sti(NPChar.money));
			Log_SetStringToLog(LanguageConvertString(tmpLangFileID,"You got") + " " +  sti(NPChar.money) + " " + XI_ConvertString("gold."));
			if(AUTO_SKILL_SYSTEM) { AddPartyExpChar(pchar, "Sneak", 100+sti(NPChar.money)/4)); }
			else { AddPartyExp(pchar, 100+sti(NPChar.money)/4)); }
			d.Text = DLG_TEXT[248];
			Link.l2 = LinkRandPhrase(DLG_TEXT[249], DLG_TEXT[250], DLG_TEXT[251]);
			Link.l2.go = "exit_outrep";
			Link.l3 = LinkRandPhrase(DLG_TEXT[252], DLG_TEXT[253], DLG_TEXT[254]);
			Link.l3.go = "jewel";
		break;

		case "jewel":
			GiveItem2Character(pchar, "jewelry"+(1+rand(15)));
			if(rand(100)+sti(PChar.skill.leadership)<50)
			{
				Log_SetStringToLog(LanguageConvertString(tmpLangFileID,"The thief spreads the news"));
				Log_SetStringToLog(LanguageConvertString(tmpLangFileID,"that you receive stolen goods."));
				ChangeCharacterReputation(pchar, -5);
			}
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "moneyback":
			if(rand(100)>30)
			{
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneyToCharacter(pchar, FakeMoney);
			Log_SetStringToLog(LanguageConvertString(tmpLangFileID,"You got") + " " +  FakeMoney + " " + XI_ConvertString("gold."));
			if(AUTO_SKILL_SYSTEM) { AddPartyExpChar(pchar, "Sneak", 100+makeint(FakeMoney/4))); }
			else { AddPartyExp(pchar, 100+makeint(FakeMoney/4))); }
			d.Text = DLG_TEXT[245];
			Link.l1 = DLG_TEXT[247];
			Link.l1.go = "donation";
			Link.l2 = DLG_TEXT[246];
			Link.l2.go = "exit_out";
			}
			else
			{
			GiveItem2Character(pchar, "jewelry"+(1+rand(15)));
			if(AUTO_SKILL_SYSTEM) { AddPartyExpChar(pchar, "Sneak", 100+makeint(FakeMoney/2))); }
			else { AddPartyExp(pchar, 100+makeint(FakeMoney/2))); }
			d.Text = DLG_TEXT[266];
			Link.l2 = DLG_TEXT[268];
			Link.l2.go = "jewel";
			Link.l3 = DLG_TEXT[267];
			if(rand(100)+sti(pchar.skill.leadership)>50) {Link.l3.go = "moneydouble";}
			else{Link.l3.go = "nomoney";}
			}
		break;

		case "donation":
			ChangeCharacterReputation(pchar, 2); 
		    PlayStereoSound("INTERFACE\took_item.wav");
		    // TIH --> to prevent giving all your money back to the bastard! Aug29''06
		    int donationSum = 50 + rand(300);
		    if ( sti(Pchar.money) < donationSum ) donationSum = makeint(sti(Pchar.money) / 2);
			AddMoneytoCharacter(Pchar, -donationSum);
			AddMoneytoCharacter(NPchar, donationSum);
			// TIH <--
			Diag.CurrentNode = "thanx";
			DialogExit();
		break;
		//ccc pickpocket <-

		//SCREWFACE : RANDOM TREASURE QUEST GENERATOR---------------------------------------
		case "why":
			d.text = DLG_TEXT[282];
			link.l1 = DLG_TEXT[283];
			link.l1.go = "why_2";
		break;

		case "why_2":
			d.text = DLG_TEXT[284];
			link.l1 = DLG_TEXT[285];
			link.l1.go = "why_3";
		break;

		case "why_3":
			d.text = DLG_TEXT[286] + DLG_TEXT[287]);
			link.l1 = DLG_TEXT[288];
			link.l1.go = "tell_price";
		break;

		case "tell_price":
			Npchar.skill.sneak = rand(Makeint(Pchar.skill.sneak));
			sum = makeint((sti(NPchar.skill.sneak) + 1) * rand(50000));
		//	sum = 10;// DEBUG OVERRIDE
			Npchar.money = -sum;
			d.text = Sum + DLG_TEXT[289];
			if(makeint(Pchar.money) < Sum)
			{
				link.l1 = DLG_TEXT[291];
				link.l1.go = "exit_out";
			}
			else
			{
				link.l1 = DLG_TEXT[290];
				link.l1.go = "accept_secret";
				link.l2 = DLG_TEXT[291];
				link.l2.go = "exit_out";
			}
		break;

		case "accept_secret":
			Diag.CurrentNode = "get_out";
			DialogExit();
			GenerateTreasureQuest(PChar, NPChar, sum);
		break;
		// SCREWFACE END-------------------------------------------------------------

		case "exit_Fencing":
			Diag.CurrentNode = "Fencing2";
			DialogExit();
		break;

		case "exit_Defence":
			Diag.CurrentNode = "Defence2";
			DialogExit();
		break;

		case "exit_Leadership":
			Diag.CurrentNode = "Leadership2";
			DialogExit();
		break;

		case "exit_Sailing":
			Diag.CurrentNode = "Sailing2";
			DialogExit();
		break;

		case "exit_Accuracy":
			Diag.CurrentNode = "Accuracy2";
			DialogExit();
		break;

		case "exit_Cannons":
			Diag.CurrentNode = "Cannons2";
			DialogExit();
		break;

		case "exit_Grappling":
			Diag.CurrentNode = "Grappling2";
			DialogExit();
		break;

		case "exit_Repair":
			Diag.CurrentNode = "Repair2";
			DialogExit();
		break;

		case "exit_Commerce":
			Diag.CurrentNode = "Commerce2";
			DialogExit();
		break;

		case "exit":
			//ccc pickpocket -->
			int pickch=rand(100)+sti(PChar.skill.sneak) + NO_THEFT;
			if (pickch<=30)
			{
				int pickgold=sti(pchar.rank)*1000;
				if(makeint(Pchar.money)<pickgold) pickgold=makeint(Pchar.money)-9;
				PlayStereoSound("INTERFACE\took_item.wav");
				AddMoneyToCharacter(pchar, - pickgold);
				NPChar.money=pickgold;
				Log_SetStringToLog(LanguageConvertString(tmpLangFileID,"This meeting has really lightened you...")); //NO typo!
				if(AUTO_SKILL_SYSTEM)
				{
					AddPartyExpChar(pchar, "Leadership", 20+Rand(40));
					AddPartyExpChar(pchar, "Sneak", 20+Rand(40));
				}
				else { AddPartyExp(pchar, 20+Rand(40)); }
				Diag.CurrentNode="stolen";
				DialogExit();
			}
			else
			{ 
				if (pickch>30&&pickch<60)			
				{
					PlaySound("INTERFACE\took_item.wav");
					d.text = DLG_TEXT[255]; 
					winlink=rand(100); 
					if (winlink>=50) 
					{
						Link.l1 = LinkRandPhrase(DLG_TEXT[260], DLG_TEXT[261], DLG_TEXT[262]);
						if(rand(100)+(sti(pchar.skill.Sneak)*3)>20){Link.l1.go = "pursegot";}
						else{Link.l1.go = "alarm";}
					}
					Link.l2 = DLG_TEXT[256];
					Link.l2.go = "exit_outrep";
					Link.l3 = LinkRandPhrase(DLG_TEXT[257], DLG_TEXT[258], DLG_TEXT[259]);
					Link.l3.go = "alarm";
					if(winlink<50) 
					{
						Link.l1 = LinkRandPhrase(DLG_TEXT[260], DLG_TEXT[261], DLG_TEXT[262]);
						if(rand(100)+(sti(pchar.skill.Sneak)*3)>20){Link.l1.go = "pursegot";}
						else{Link.l1.go = "alarm";}
					}
				}
				else
				{
					Diag.CurrentNode = "sovet";
					Log_SetStringToLog(LanguageConvertString(tmpLangFileID,"This meeting has really enlightened you..."));
					if(AUTO_SKILL_SYSTEM)
					{
						AddPartyExpChar(pchar, "Leadership", 20+Rand(40));
						AddPartyExpChar(pchar, "Sneak", 20+Rand(40));
					}
					else { AddPartyExp(pchar, 20+Rand(40)); }
					DialogExit();
				}
			}
		break;

		case "exit_outrep":
			if(NPchar.sex == "woman") {PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_f_c_007.wav");}
			else{PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_007.wav");}
			ChangeCharacterReputation(pchar, 1);
			Diag.CurrentNode = "thanx";
			DialogExit();
		break;
		//ccc pickpocket <-

		case "exit1":
			if(NPchar.sex == "woman") {PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_f_c_007.wav");}
			else{PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_007.wav");}
			ChangeCharacterReputation(pchar, 1); //ccc from 3
			PlayStereoSound("INTERFACE\took_item.wav");
			AddMoneytoCharacter(Pchar, -20);
			Diag.CurrentNode = "thanx";
			DialogExit();
		break;

		case "exit_out":
			Diag.CurrentNode = "get_out";
			DialogExit();
		break;

		case "exit_once_more":
			Diag.CurrentNode = "once_more";
			DialogExit();
		break;

		case "exit_once_more_portion":
			Diag.CurrentNode = "once_more_portion";
			DialogExit();
		break;
		
		case "exit_than":
			Diag.CurrentNode = "thanx";
			DialogExit();
		break;

		case "exit_off":
			Diag.CurrentNode = "got_officer";
			DialogExit();
		break;

		// NK -->
		case "exit_change_dlg":
			Diag.CurrentNode = "Node_1";
			DialogExit();
			DialogMain(characterFromID(PChar.newofficerid));//MAXIMUS
			DeleteAttribute(PChar,"newofficerid");//MAXIMUS
		break;
		// NK <--
	}
	LanguageCloseFile(tmpLangFileID);
}
