/* Interest talks */
IF %BGT_VAR%
Global("X#SharMatch","GLOBAL",0)
CheckStatGT(Player1,10,CHR)
CheckStatGT(Player1,10,STR)
Gender(Player1,MALE)
!Alignment(Player1,MASK_GOOD)
!Alignment(Player1,LAWFUL_NEUTRAL)
!Race(Player1,HALFLING)
ReputationLT(Player1,10)
!HasItemEquiped("%tutu_var%BELT05",Player1) //girdle of gender bender
THEN
RESPONSE #100
RealSetGlobalTimer("X#SharInterestTime","GLOBAL",100)
SetGlobal("X#SharMatch","GLOBAL",1)
END

/* Small snippet  from IntTalk 11 */
IF %BGT_VAR%
Global("X#SharBunk","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
IncrementGlobal("X#SharBunk","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#SharBunk","GLOBAL",2)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("shrar")
StartDialogueNoSet(Player1)
END

/* First part of talks, 2 through 11 */
IF %BGT_VAR%
RealGlobalTimerExpired("X#SharInterestTime","GLOBAL")
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
OR(14)
Global("X#SharInterestTalk","GLOBAL",3)
Global("X#SharInterestTalk","GLOBAL",5)
Global("X#SharInterestTalk","GLOBAL",7)
Global("X#SharInterestTalk","GLOBAL",11)
Global("X#SharInterestTalk","GLOBAL",15)
Global("X#SharInterestTalk","GLOBAL",17)
Global("X#SharInterestTalk","GLOBAL",19)
Global("X#SharInterestTalk","GLOBAL",21)
Global("X#SharInterestTalk","GLOBAL",23)
Global("X#SharInterestTalk","GLOBAL",27)
Global("X#SharInterestTalk","GLOBAL",29)
Global("X#SharInterestTalk","GLOBAL",31)
Global("X#SharInterestTalk","GLOBAL",33)
Global("X#SharInterestTalk","GLOBAL",41)
OR(2)
Global("X#SharInterest","GLOBAL",1)
Global("X#SharInterest","GLOBAL",2)
ReputationLT(Player1,11)
THEN
RESPONSE #100
IncrementGlobal("X#SharInterestTalk","GLOBAL",1)
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#SharInterestTime","GLOBAL")
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
OR(17)
Global("X#SharInterestTalk","GLOBAL",4)
Global("X#SharInterestTalk","GLOBAL",6)
Global("X#SharInterestTalk","GLOBAL",8)
Global("X#SharInterestTalk","GLOBAL",12)
Global("X#SharInterestTalk","GLOBAL",14)
Global("X#SharInterestTalk","GLOBAL",16)
Global("X#SharInterestTalk","GLOBAL",18)
Global("X#SharInterestTalk","GLOBAL",20)
Global("X#SharInterestTalk","GLOBAL",22)
Global("X#SharInterestTalk","GLOBAL",24)
Global("X#SharInterestTalk","GLOBAL",26)
Global("X#SharInterestTalk","GLOBAL",28)
Global("X#SharInterestTalk","GLOBAL",30)
Global("X#SharInterestTalk","GLOBAL",32)
Global("X#SharInterestTalk","GLOBAL",34)
Global("X#SharInterestTalk","GLOBAL",40)
Global("X#SharInterestTalk","GLOBAL",42)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("shrar")
StartDialogueNoSet(Player1)
END

/* Interest Talk 7 */
IF %BGT_VAR%
RealGlobalTimerExpired("X#SharInterestTime","GLOBAL")
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
Global("X#SharInterestTalk","GLOBAL",13)
Global("X#SharInterest","GLOBAL",1)
ReputationLT(Player1,11)
Global("X#SharMatch","GLOBAL",1)
HPPercentLT(Player1,95)
THEN
RESPONSE #100
IncrementGlobal("X#SharInterestTalk","GLOBAL",1)
END

/* Interest Talk 20 */
IF %BGT_VAR%
Global("X#SharInterestTalk","GLOBAL",39)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
Global("X#SharInterest","GLOBAL",2)
ReputationLT(Player1,11)
OR(4)
AreaCheck("%Candlekeep_Catacombs_L1Antechamber%")
AreaCheck("%Candlekeep_Catacombs_L1%")
AreaCheck("%Candlekeep_Catacombs_L2%")
AreaCheck("%CandlekeepCaves%")
THEN
RESPONSE #100
IncrementGlobal("X#SharInterestTalk","GLOBAL",1)
END

/* Set Shar Interest = 2 */
IF %BGT_VAR%
InParty(Myself)
GlobalGT("X#SharInterestTalk","GLOBAL",32)
Global("X#SharInterest","GLOBAL",1)
THEN
RESPONSE #100
SetGlobal("X#SharInterest","GLOBAL",2)
END

/* Floaters */
/* Angelo Talk */
IF %BGT_VAR%
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
Global("X#SharFloater1","GLOBAL",0)
Global("X#SharInterest","GLOBAL",2)
ReputationLT(Player1,11)
Global("X#SharAngelo1","GLOBAL",1)
THEN
RESPONSE #100
IncrementGlobal("X#SharFloater1","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#SharFloater1","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("shrar")
StartDialogueNoSet(Player1)
END

IF %BGT_VAR%
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
Global("X#SharFloater2","GLOBAL",0)
Global("X#SharInterest","GLOBAL",2)
ReputationLT(Player1,11)
AreaCheck("%Undercity%")
THEN
RESPONSE #100
IncrementGlobal("X#SharFloater2","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#SharFloater2","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("shrar")
StartDialogueNoSet(Player1)
END

/* For Ring Talk */
IF %BGT_VAR%
InParty(Myself)
Global("X#SharRing","GLOBAL",3)
Global("X#SharDestroyRing","GLOBAL",0)
PartyHasItem("%tutu_var%RING15")
THEN
RESPONSE #100
SetGlobal("X#SharDestroyRing","GLOBAL",1)
TakePartyItem("%tutu_var%RING15")
DestroyItem("%tutu_var%RING15")
END

/* Shar Reacts to Delainy */
IF %BGT_VAR%
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
OR(2)
Global("X#SharInterest","GLOBAL",1)
Global("X#SharInterest","GLOBAL",2)
Global("GottaGetFlowers","GLOBAL",1)
Global("X#SharDelFlower","GLOBAL",0)
THEN
RESPONSE #100
IncrementGlobal("X#SharDelFlower","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#SharDelFlower","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("shrar")
StartDialogueNoSet(Player1)
END

IF %BGT_VAR%
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
OR(2)
Global("X#SharInterest","GLOBAL",1)
Global("X#SharInterest","GLOBAL",2)
Global("GottaGetFlowers","GLOBAL",1)
Global("X#SharDelFlower","GLOBAL",2)
PartyHasItem("%tutu_var%MISC1I")
THEN
RESPONSE #100
IncrementGlobal("X#SharDelFlower","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#SharDelFlower","GLOBAL",3)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("shrar")
StartDialogueNoSet(Player1)
END

/* NPC-Initiated Flirts */
/* Early in Romance */
IF %BGT_VAR%
InParty(Myself)
Global("X#SharInterest","GLOBAL",1)
Global("X#SharCheckFlirtEarly","GLOBAL",0)
THEN
RESPONSE #100
RealSetGlobalTimer("X#SharFlirtEarlyTime","GLOBAL",300)
SetGlobal("X#SharCheckFlirtEarly","GLOBAL",1)
END

IF %BGT_VAR%
InParty(Myself)
!Global("X#SharDisableFlirts","GLOBAL",1)
RealGlobalTimerExpired("X#SharFlirtEarlyTime","GLOBAL")
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
Global("X#SharInterest","GLOBAL",1)
Global("X#SharFlirtEarly","GLOBAL",0)
!AreaType(DUNGEON)
THEN
RESPONSE #100
SetGlobal("X#SharFlirtEarly","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#SharFlirtEarly","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("shrar")
StartDialogueNoSet(Player1)
END

/* kind/non-kind */
IF %BGT_VAR%
InParty(Myself)
!Global("X#SharDisableFlirts","GLOBAL",1)
Global("X#SharInterest","GLOBAL",2)
GlobalLT("X#SharKind","GLOBAL",6)
!Global("X#SharFlirtKind","GLOBAL",2)
THEN
RESPONSE #100
RealSetGlobalTimer("X#SharFlirtLateTime","GLOBAL",1000)
SetGlobal("X#SharFlirtLate","GLOBAL",0)
SetGlobal("X#SharFlirtKind","GLOBAL",2)
END

IF %BGT_VAR%
InParty(Myself)
!Global("X#SharDisableFlirts","GLOBAL",1)
Global("X#SharInterest","GLOBAL",2)
GlobalGT("X#SharKind","GLOBAL",5)
!Global("X#SharFlirtLate","GLOBAL",2)
THEN
RESPONSE #100
RealSetGlobalTimer("X#SharFlirtKindTime","GLOBAL",1000)
SetGlobal("X#SharFlirtLate","GLOBAL",2)
SetGlobal("X#SharFlirtKind","GLOBAL",0)
END

/* Late in Romance, non-'kind' flirts */
IF %BGT_VAR%
RealGlobalTimerExpired("X#SharFlirtLateTime","GLOBAL")
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
!Global("X#SharDisableFlirts","GLOBAL",1)
CombatCounter(0)
!See([ENEMY])
See(Player1)
Global("X#SharInterest","GLOBAL",2)
Global("X#SharFlirtLate","GLOBAL",0)
!AreaType(DUNGEON)
THEN
RESPONSE #100
SetGlobal("X#SharFlirtLate","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#SharFlirtLate","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("shrar")
StartDialogueNoSet(Player1)
END

/* Late in romance, 'kind' flirts */
IF %BGT_VAR%
InParty(Myself)
RealGlobalTimerExpired("X#SharFlirtKindTime","GLOBAL")
!Global("X#SharDisableFlirts","GLOBAL",1)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
Global("X#SharInterest","GLOBAL",2)
Global("X#SharFlirtKind","GLOBAL",0)
!AreaType(DUNGEON)
THEN
RESPONSE #100
SetGlobal("X#SharFlirtKind","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#SharFlirtKind","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("shrar")
StartDialogueNoSet(Player1)
END

/* Shar Knows that a Player is a Paladin or Ranger */
IF %BGT_VAR%
InParty(Myself)
Global("X#SharGoodCheck","GLOBAL",0)
Gender(Player1,MALE)
CheckStatGT(Player1,10,CHR)
CheckStatGT(Player1,10,STR)
ReputationGT(Player1,10)
OR(2)
Class(Player1,PALADIN_ALL)
Class(Player1,RANGER_ALL)
!Alignment(Player1,MASK_EVIL)
THEN
RESPONSE #100
IncrementGlobal("X#SharGoodCheck","GLOBAL",1)
END

/* Shar-Teel Reacts when the appropriate guy Falls */
IF %BGT_VAR%
InParty(Myself) 
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
Global("X#SharGoodCheck","GLOBAL",1)
ReputationLT(Player1,11)
CheckStatGT(Player1,11,CHR)
CheckStatGT(Player1,11,STR)
OR(2)
Class(Player1,PALADIN_ALL)
Class(Player1,RANGER_ALL)
Global("X#SharFallenTalk","GLOBAL",0)
THEN
RESPONSE #100
IncrementGlobal("X#SharGoodCheck","GLOBAL",1)
RealSetGlobalTimer("X#SharInterestTime","GLOBAL",SHROM_TIMER)
SetGlobal("X#SharMatch","GLOBAL",1)
SetGlobal("X#SharFallenTalk","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#SharFallenTalk","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("shrar")
StartDialogueNoSet(Player1)
END