/////////////////////////////////////////////////////////////////////
// SHDOCK.S
/////////////////////////////////////////////////////////////////////

SETUP

	IF gt_RROCK_TO_SHDOCK
		RemoveC SKIFF
		PlaceC SKIFF pSKIFF_ARRIVED
	ELSE
		PlaceC SKIFF pSKIFF_START
	ENDIF

    IF  !gd_PLACED_SD_TOWNSFOLK
        Add gd_PLACED_SD_TOWNSFOLK

        PlaceC              SD_TOWNSFOLK_F1     pSD_TOWNS_F1
        PlaceC              SD_TOWNSFOLK_F2     pSD_TOWNS_F2
        PlaceC              SD_TOWNSFOLK_M1     pSD_TOWNS_M1
        PlaceC              SD_TOWNSFOLK_M2     pSD_TOWNS_M2
        PlaceC              SD_TOWNSFOLK_M3     pSD_TOWNS_M3
		RunS Gipper1Actions
		RunS Gipper2Actions
		RunS Gipper3Actions
		RunS Gipper4Actions
		RunS Gipper5Actions

    ENDIF

	IF gt_SKIFF_CHART_TRADED && !gt_PLAYED_SKIFF_SOLDIER
		PlaceC SKIFF_SOLDIER pSOLDIER
		AwardOb SKIFF_SOLDIER rainbow_chart "skiff-chart"
		LookAtTurn SKIFF SKIFF_SOLDIER
	ENDIF

	IF !mj_BLOODMASTER_BANE
		IF !gt_DELGAR_AT_SHDOCK
			Add gt_DELGAR_AT_SHDOCK
			PlaceC DELGAR pDELGAR
			WanderNotFar DELGAR 2 10
			SwitchOnSightOfPlayer DELGAR LookAtTurnFollow P
		ENDIF
	ELSE
		IF gt_DELGAR_AT_SHDOCK
			Remove gt_DELGAR_AT_SHDOCK
			RemoveC DELGAR
		ENDIF
	ENDIF

END

VIG TempSetup FALSE

	Set	gd_WEATHER_TYPE	0
	Set gd_WIND_TYPE	1
    RunS CueWeather

	SetLiquid ALL 500 2 2
	SetWaterType 0
	AddBigFire 13655 28153

	CachePortrait DELGRDIM.BIN
	CachePortrait DWARREVL.BIN
	CachePortrait PC2.BIN
	CachePortrait SKIFF.BIN

END

/////////////////////////////////////////////////////////////////////

VIG Gipper1Actions FALSE

    AddControl          SD_TOWNSFOLK_F1     Capture     cM_TALK_CROWD1
    AddControl          SD_TOWNSFOLK_F1     Capture     cM_TALK_CROWD2
    AddControl          SD_TOWNSFOLK_F1     Capture     cM_TALK_BECKON_BEHIND3
    AddControl          SD_TOWNSFOLK_F1     Capture     cM_TALK_REFER_OTHER_PERSON1
    AddControl          SD_TOWNSFOLK_F1     LookAtTurn  SG_TOWNSFOLK_F2
    AddControl          SD_TOWNSFOLK_F1     LookAtTurn  SG_TOWNSFOLK_M1
    SequenceRandomlySelects SD_TOWNSFOLK_F1
    AddFilter           SD_TOWNSFOLK_F1        KeepPositionD   pSD_TOWNS_F1
    Lock                SD_TOWNSFOLK_F1

END

/////////////////////////////////////////////////////////////////////

VIG Gipper2Actions FALSE

    AddControl          SD_TOWNSFOLK_F2     Capture     cM_STAND1
    AddControl          SD_TOWNSFOLK_F2     Capture     cM_STAND2
    AddControl          SD_TOWNSFOLK_F2     Capture     cM_TALK_QUESTION2
    AddControl          SD_TOWNSFOLK_F2     Capture     cM_TALK_AGREE1
    SequenceRandomlySelects SD_TOWNSFOLK_F2
    AddFilter           SD_TOWNSFOLK_F2        KeepPositionD   pSD_TOWNS_F2
    Lock                SD_TOWNSFOLK_F2

END

/////////////////////////////////////////////////////////////////////

VIG Gipper3Actions FALSE

    AddControl          SD_TOWNSFOLK_M1     Capture     cM_STAND3
    AddControl          SD_TOWNSFOLK_M1     Capture     cM_STAND4
    AddControl          SD_TOWNSFOLK_M1     Capture     cM_TALK_REFER_OTHER_PERSON2
    AddControl          SD_TOWNSFOLK_M1     Capture     cM_SHRUG1
    SequenceRandomlySelects SD_TOWNSFOLK_M1
    AddFilter           SD_TOWNSFOLK_M1        KeepPositionD   pSD_TOWNS_M1
    Lock                SD_TOWNSFOLK_M1

END

/////////////////////////////////////////////////////////////////////

VIG Gipper4Actions FALSE

    WanderNotFar        SD_TOWNSFOLK_M2     6    20

END

/////////////////////////////////////////////////////////////////////

VIG Gipper5Actions FALSE

    WanderNotFar        SD_TOWNSFOLK_M3     6    20

END

/////////////////////////////////////////////////////////////////////

VIG TalkToGipper1 MSG-iSD_TOWNSFOLK_M1

	Widescreen TRUE
	UnDrawSwordRemember
	EngageAndFace P SD_TOWNSFOLK_M1
	UUComplete P
	IF mj_DEFEAT_LIGHTSTEALER
		//"Listen close...a Thardolin ship was sighted..."
		Say bkm003 BKINMAN1.BIN
	ELSE
		//"Hail, brother. Our war against Lightstealer goes well."
		Say bkm002 BKINMAN1.BIN
		Add co_LIGHTSTEALER
	ENDIF
	Widescreen FALSE

END

/////////////////////////////////////////////////////////////////////

VIG TalkToGipper2 MSG-iSD_TOWNSFOLK_M2

	Widescreen TRUE
	UnDrawSwordRemember
	EngageAndFace P SD_TOWNSFOLK_M2
	UUComplete P
	IF mj_DEFEAT_LIGHTSTEALER
		//"Listen close...a Thardolin ship was sighted..."
		Say bkm003 BKINMAN2.BIN
	ELSE
		//"Hail, brother. Our war against Lightstealer goes well."
		Say bkm002 BKINMAN2.BIN
		Add co_LIGHTSTEALER
	ENDIF
	Widescreen FALSE

END

/////////////////////////////////////////////////////////////////////

VIG TalkToGipper3 MSG-iSD_TOWNSFOLK_M3

	Widescreen TRUE
	UnDrawSwordRemember
	EngageAndFace P SD_TOWNSFOLK_M3
	UUComplete P
	IF mj_DEFEAT_LIGHTSTEALER
		//"Listen close...a Thardolin ship was sighted..."
		Say bkm003 BKINMAN3.BIN
	ELSE
		//"Hail, brother. Our war against Lightstealer goes well."
		Say bkm002 BKINMAN3.BIN
		Add co_LIGHTSTEALER
	ENDIF
	Widescreen FALSE

END

/////////////////////////////////////////////////////////////////////

VIG TalkToGipper4 MSG-iSD_TOWNSFOLK_F1

	Widescreen TRUE
	UnDrawSwordRemember
	EngageAndFace P SD_TOWNSFOLK_F1
	UUComplete P
	IF !mj_RESCUE_BANE
		//"Be wary...things have been sighted at Khulindah's mound."
		Say bkf003 BKINFEM4.BIN
	ELSE
		//"Greetings, brother...we will soon return to our homeland."
		Say bkf002 BKINFEM4.BIN
	ENDIF
	Widescreen FALSE

END

/////////////////////////////////////////////////////////////////////

VIG TalkToGipper5 MSG-iSD_TOWNSFOLK_F2

	Widescreen TRUE
	UnDrawSwordRemember
	EngageAndFace P SD_TOWNSFOLK_F2
	UUComplete P
	IF !mj_RESCUE_BANE
		//"Be wary...things have been sighted at Khulindah's mound."
		Say bkf003 BKINFEM2.BIN
	ELSE
		//"Greetings, brother...we will soon return to our homeland."
		Say bkf002 BKINFEM2.BIN
	ENDIF
	Widescreen FALSE

END

/////////////////////////////////////////////////////////////////////

VIG ArrivalFromRainbowRock gt_RROCK_TO_SHDOCK

	Widescreen TRUE
	RunS QPalFadeRPG
	Wait 2500
	//"Mighty obliged to have that chart back..."
	Say if012e SKIFF.BIN

	Remove gt_RROCK_TO_SHDOCK

	MoveCDir SKIFF pSKIFF_START
	Widescreen FALSE

END

/////////////////////////////////////////////////////////////////////

VIG TalkToSkiff MSG-iSKIFF

	Widescreen TRUE
	UnDrawSwordRemember
	EngageAndFace P SKIFF

	IF !ce_SKIFF
		//"Hello there, traveller. You new in town aintcha?"
		Say if0005 SKIFF.BIN

		//"Yes. On business."
		Say Hx0251

		//"I'm Skiff. This ship in the harbour's mine..."
		Say if0003 SKIFF.BIN

		ChangeProfileToIdentified Scitizen_Skiff
		Add ce_SKIFF
	ELSE
		//"Back Again lad?"
		Say ifx002 SKIFF.BIN
	ENDIF

	ResetChoice
	WHILE !MenuExit
		ClearChoices

		//IF co_RAINBOWROCK
			IF gt_GIVEN_SKIFF_CHART && !mj_DEFEAT_GARGOS_2
				//Set Sail
				AddChoice 1 tx0101
			ELSE
				//Hire Ship
				AddChoice 2 tx0100
			ENDIF
		IF co_RAINBOWROCK
			//Rainbow Rock
			AddChoice 3 tx0098
		ENDIF

		IF !mj_DEFEAT_GARGOS_2
			IF co_THEGUILD
				//The Guild
				AddChoice 4 tx0097
			ENDIF

			IF co_LORDCRUX
				//Lord Crux
				AddChoice 5 tx0102
			ENDIF

			IF co_ARADDHOM || ce_ARADDHOM
				//Arad Dhom
				AddChoice 6 tx0103
			ENDIF
		ENDIF

		//Leave
		AddChoice 0 tx0003

		GetChoice SKIFF

		SWITCH Choice
			CASE 1
				//Set Sail

				//"Right you are me lad..."
				QuickSay if012d SKIFF.BIN
				Wait 1000
				MoveCDir SKIFF pSKIFF_BOARDING
				Follow P SKIFF

				UUSay
				RunS PalFadeBLACK

				Add gt_SHDOCK_TO_RROCK
				RemoveC SKIFF

				SetChoiceToExit

				PostMsg t_RA_DOCK

			CASE 2
				//Hire Ship

				IF mj_DEFEAT_GARGOS_2
					//"...can't do that...Thardolin fleet...anchored off the coast...suicide."
					Say if0025 SKIFF.BIN
				ELSE
					IF !POS-P-rainbow_chart
						//"Can't do that, right now, me lad..."
						Say if0008 SKIFF.BIN

						//"Why's that?"
						Say Hx0256

						//"...reefs...Used to have a chart...lost it...to...Arad Dhom."
						Say if0009 SKIFF.BIN

						IF !co_SEACHART
							Add co_ARADDHOM
							Add co_RAINBOWROCK
							Add co_SEACHART
							QLAdd ql201 qlt201 qlb201
						ENDIF
					ELSE
					
						Add gt_GIVEN_SKIFF_CHART

						Capture P cM_TOSS_GENTLE
						Capture SKIFF cM_OBJ_ACCEPT_1H1

						DeleteObjectsInBackpackWithID P rainbow_chart

						UUComplete P

						//"Thank you...Just tell me when you want to be heading off."
						Say if012a SKIFF.BIN
						QLRemove ql201
						AwardEP xp_SKIFF_CHART
					ENDIF
				ENDIF

			CASE 3
				//Rainbow Rock

				IF mj_DEFEAT_GARGOS_2
					//"...the Thardolin fleet...building..."
					Say if0026 SKIFF.BIN
				ELSE
					//"I can't tell you much...named after a stone...runes..."
					Say if0013 SKIFF.BIN
				ENDIF

			CASE 4
				//The Guild

				IF ISEQUIPED-P-guild_ring

					Capture SKIFF cM_TALK_DISAGREE1

					//"There's no Guild that I know of..."
					Say if0015 SKIFF.BIN
				ELSE
					//"I don't know...I do know about Crux...sounds like...he'd be involved..."
					Say if0017 SKIFF.BIN

					Add co_LORDCRUX
				ENDIF

			CASE 5
				//Lord Crux

				//"Crux owns this town...lives...through the west gate...Big place...guarded..."
				Say if0019 SKIFF.BIN
				ChangeProfileToIdentified Sassassin_Crux

			CASE 6
				//Arad Dhom

				//"That drunkard...just drinks and gambles...managed to win my sea-chart..."
				Say if0020 SKIFF.BIN

			CASE 0
				//Leave

				//"Farewell, lad. Keep your head down."
				Say if0023 SKIFF.BIN
		ENDSWITCH
	ENDWHILE
	Widescreen FALSE
//	DrawSwordRemember
END

/////////////////////////////////////////////////////////////////////

VIG SkiffAndSoldier ONESEC && gt_SKIFF_CHART_TRADED && !gt_PLAYED_SKIFF_SOLDIER && (INAREA-P-ON_PIER || MSG-iSKIFF || DAMAGED-SKIFF_SOLDIER)

	Widescreen TRUE

	EngagePoint P pSKIFF_ARRIVED 500
	AddControl P LookAtTurn SKIFF_SOLDIER
	Say ds00x1 DWARREVL.BIN
	GiveSightOfPlayerTo SKIFF_SOLDIER
	AttackDemo2 SKIFF_SOLDIER
	Add gt_PLAYED_SKIFF_SOLDIER

	Widescreen FALSE

END

/////////////////////////////////////////////////////////////////////

VIG TalkToDelgarDim MSG-iDELGAR

	Widescreen TRUE
	UnDrawSwordRemember
	EngageAndFace P DELGAR

	IF ce_DELGAR
		Say dd0002
	ELSE
		Add ce_DELGAR
		ChangeProfileToIdentified Tcitizen_DelgarDim
		Say dd0001
	ENDIF

	ResetChoice
	WHILE !MenuExit
		ClearChoices

		//Trade
		AddChoice 1 tx0008

		//Leave
		AddChoice 0 tx0003

		GetChoice DELGAR

		SWITCH Choice
			CASE 1
				//Trade

				Say dd0003
				MessagesOff
				SHOPPANEL DELG_SHOP 200 50 DELGAR BUYSELL
				MessagesOn
				Say dd0004

			CASE 0
				//Leave

				SWITCH RAND-2
					CASE 0
						Say dd0005
					CASE 1
						Say dd0006
				ENDSWITCH
		ENDSWITCH
	ENDWHILE

	Widescreen FALSE
	WanderNotFar DELGAR 2 10
	SwitchOnSightOfPlayer DELGAR LookAtTurnFollow P

END

/////////////////////////////////////////////////////////////////////
