IF
InParty(Myself)
Global("DreamTimerStarted","GLOBAL",0)
THEN
RESPONSE #100
RealSetGlobalTimer("DreamTalk","GLOBAL",180)
SetGlobal("DreamTimerStarted","GLOBAL",1)
END

IF
InParty(Myself)
Global("ShLowReputation","GLOBAL",0)
Global("ShMedReputation","GLOBAL",0)
Global("ShHighReputation","GLOBAL",0)
Global("ShHighMale","GLOBAL",0)
Global("SharPCTimerStarted","GLOBAL",0)
THEN
RESPONSE #100
RealSetGlobalTimer("SharPCTalks","GLOBAL",10)
SetGlobal("SharPCTimerStarted","GLOBAL",1)
END

//Shar-PC talks//
//female low rep a male in the party
IF
InParty(Myself) CombatCounter(0) !See([ENEMY])
RealGlobalTimerExpired("SharPCTalks","GLOBAL")
ReputationLT(Player1,6)
Gender(Player1,FEMALE)
OR(5)
Gender(Player2,MALE)
Gender(Player3,MALE)
Gender(Player4,MALE)
Gender(Player5,MALE)
Gender(Player6,MALE)
Global("ShLowReputation","GLOBAL",0)
!Global("ShMedReputation","GLOBAL",2)
!Global("ShHighReputation","GLOBAL",2)
THEN
RESPONSE #100
IncrementGlobal("ShLowReputation","GLOBAL",1)
RealSetGlobalTimer("ShLowReputationTime","GLOBAL",10)
Interact(Player1)
END

IF 
InParty(Myself) CombatCounter(0) !See([ENEMY])
RealGlobalTimerExpired("ShLowReputationTime","GLOBAL")
Global("ShLowReputation","GLOBAL",1)
THEN
RESPONSE #100
IncrementGlobal("ShLowReputation","GLOBAL",1)
RealSetGlobalTimer("SharPCTalks","GLOBAL",1800)
END

//female med rep a male in the party (6 to 12 inclusive)
IF
InParty(Myself) CombatCounter(0) !See([ENEMY])
RealGlobalTimerExpired("SharPCTalks","GLOBAL")
ReputationGT(Player1,5) !ReputationLT(Player1,13)
Gender(Player1,FEMALE)
OR(5)
Gender(Player2,MALE)
Gender(Player3,MALE)
Gender(Player4,MALE)
Gender(Player5,MALE)
Gender(Player6,MALE)
!Global("ShLowReputation","GLOBAL",2)
Global("ShMedReputation","GLOBAL",0)
!Global("ShHighReputation","GLOBAL",2)
THEN
RESPONSE #100
IncrementGlobal("ShMedReputation","GLOBAL",1)
RealSetGlobalTimer("ShMedReputationTime","GLOBAL",10)
Interact(Player1)
END

IF 
InParty(Myself)
RealGlobalTimerExpired("ShMedReputationTime","GLOBAL")
Global("ShMedReputation","GLOBAL",1)
THEN
RESPONSE #100
IncrementGlobal("ShMedReputation","GLOBAL",1)
RealSetGlobalTimer("SharPCTalks","GLOBAL",1800)
END

//female pc high rep male in the party
IF
InParty(Myself) CombatCounter(0) !See([ENEMY])
RealGlobalTimerExpired("SharPCTalks","GLOBAL")
ReputationGT(Player1,12)
Gender(Player1,FEMALE)
OR(5)
Gender(Player2,MALE)
Gender(Player3,MALE)
Gender(Player4,MALE)
Gender(Player5,MALE)
Gender(Player6,MALE)
!Global("ShLowReputation","GLOBAL",2)
!Global("ShMedReputation","GLOBAL",2)
Global("ShHighReputation","GLOBAL",0)
THEN
RESPONSE #100
IncrementGlobal("ShHighReputation","GLOBAL",1)
RealSetGlobalTimer("ShHighReputationTime","GLOBAL",10)
Interact(Player1)
END

IF 
InParty(Myself)
RealGlobalTimerExpired("ShHighReputationTime","GLOBAL")
Global("ShHighReputation","GLOBAL",1)
THEN
RESPONSE #100
IncrementGlobal("ShHighReputation","GLOBAL",1)
RealSetGlobalTimer("SharPCTalks","GLOBAL",1800)
END

//Male with high rep
IF
InParty(Myself) CombatCounter(0) !See([ENEMY])
RealGlobalTimerExpired("SharPCTalks","GLOBAL")
Gender(Player1,Male)
ReputationGT(Player1,12)
!Global("ShMale","GLOBAL",2)
Global("ShHighMale","GLOBAL",0)
THEN
RESPONSE #100
IncrementGlobal("ShHighMale","GLOBAL",1)
RealSetGlobalTimer("ShHighMaleTime","GLOBAL",10)
Interact(Player1)
END

IF 
InParty(Myself)
RealGlobalTimerExpired("ShHighMaleTime","GLOBAL")
Global("ShHighMale","GLOBAL",1)
THEN
RESPONSE #100
IncrementGlobal("ShHighMale","GLOBAL",1)
RealSetGlobalTimer("SharPCTalks","GLOBAL",1800)
END

//morning after
IF
InParty(Myself) CombatCounter(0) !See([ENEMY])
Global("ShartSex","GLOBAL",1)
Global("X#SharMorning1","GLOBAL",0)
PartyRested()
See(Player1)
THEN
RESPONSE #100
SetGlobal("X#SharMorning1","GLOBAL",1)
RealSetGlobalTimer("DreamTalk","GLOBAL",180)
StartDialogueNoSet(Player1)
END

//Initiate Fight:

IF
InParty(Myself)
Global("X#SharLoveFight","GLOBAL",1)
HPPercentGT(Player1,95)
HPPercentGT("sharteel",95)
THEN
RESPONSE #100
AttackOneRound(Player1)
Continue()
END

//Fighting - shar wins

IF
Global("X#SharLoveFight","GLOBAL",1)
HPPercentLT(Player1,96)
THEN
RESPONSE #100
SetGlobal("X#SharLoveFight","GLOBAL",2)
ActionOverride("sharteel",ChangeEnemyAlly("sharteel",ALLY))
ActionOverride("sharteel",StartDialogueNoSet(Player1))
END

//Fighting shar loses

IF
Global("X#SharLoveFight","GLOBAL",1)
HPPercentGT(Player1,95)
HPPercentLT("sharteel",96)
THEN
RESPONSE #100
SetGlobal("X#SharLoveFight","GLOBAL",4)
ActionOverride("sharteel",ChangeEnemyAlly("sharteel",ALLY))
ActionOverride("sharteel",StartDialogueNoSet(Player1))
END

//Interest talks

IF
Global("X#SharMatch","GLOBAL",0)
CheckStatGT(Player1,11,CHR)
Gender(Player1,MALE)
!Alignment(Player1,MASK_GOOD)
!Race(Player1,HALFLING)
!Race(Player1,GNOME)
THEN
RESPONSE #100
SetGlobal("X#SharMatch","GLOBAL",1)
END

IF
InParty(Myself) CombatCounter(0) !See([ENEMY])
RealGlobalTimerExpired("X#SharInterestTime","GLOBAL")
OR(8)
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#SharInterest","GLOBAL",1)
ReputationLT(Player1,13)
Global("X#SharMatch","GLOBAL",1)
THEN
RESPONSE #100
IncrementGlobal("X#SharInterestTalk","GLOBAL",1)
RealSetGlobalTimer("X#SharInterestTime","GLOBAL",1)
StartDialogueNoSet(Player1)
END

IF
InParty(Myself)
RealGlobalTimerExpired("X#SharInterestTime","GLOBAL")
OR(8)
Global("X#SharInterestTalk","GLOBAL",4)
Global("X#SharInterestTalk","GLOBAL",6)
Global("X#SharInterestTalk","GLOBAL",8)
Global("X#SharInterestTalk","GLOBAL",12)
Global("X#SharInterestTalk","GLOBAL",16)
Global("X#SharInterestTalk","GLOBAL",18)
Global("X#SharInterestTalk","GLOBAL",20)
Global("X#SharInterestTalk","GLOBAL",22)
THEN
RESPONSE #100
IncrementGlobal("X#SharInterestTalk","GLOBAL",1)
RealSetGlobalTimer("X#SharInterestTime","GLOBAL",3600)
END

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

IF
InParty(Myself)
RealGlobalTimerExpired("X#SharInterestTime","GLOBAL")
Global("X#SharInterestTalk","GLOBAL",14)
THEN
RESPONSE #100
IncrementGlobal("X#SharInterestTalk","GLOBAL",1)
RealSetGlobalTimer("X#SharInterestTime","GLOBAL",3600)
END

//Small snippet

IF
InParty(Myself) 
Global("X#SharBunk","GLOBAL",1)
THEN
RESPONSE #100
IncrementGlobal("X#SharBunk","GLOBAL",1)
StartDialogueNoSet(Player1)
END


//timer for quitting

IF
InParty(Myself) CombatCounter(0) !See([ENEMY])
Global("PissedTimerStarted","GLOBAL",0)
Global("SharPissed","GLOBAL",1)
ReputationGT(Player1,15)
THEN
RESPONSE #100
SetGlobalTimer("SHAR63","GLOBAL",14000)
SetGlobal("PissedTimerStarted","GLOBAL",1)
END

IF
InParty(Myself) CombatCounter(0) !See([ENEMY])
GlobalTimerExpired("SHAR63","GLOBAL")
ReputationGT(Player1,15)
Global("SharPissed","GLOBAL",1)
See(Player1)
THEN
RESPONSE #100
IncrementGlobal("SharPissed","GLOBAL",1)
RealSetGlobalTimer("PissedTalkTime","GLOBAL",10)
Interact(Player1)
END

IF 
InParty(Myself) CombatCounter(0) !See([ENEMY])
RealGlobalTimerExpired("PissedTalkTime","GLOBAL")
Global("SharPissed","GLOBAL",2)
THEN
RESPONSE #100
IncrementGlobal("SharPissed","GLOBAL",1)
END

IF
InParty(Myself) CombatCounter(0) !See([ENEMY])
RealGlobalTimerExpired("DreamTalk","GLOBAL")
Global("SHKI1","LOCALS",0)
PartyRested()
See("Kivan")
THEN
RESPONSE #100
SetGlobal("SHKI1","LOCALS",1)
RealSetGlobalTimer("DreamTalk","GLOBAL",180)
StartDialogueNoSet("Kivan")
END

IF
InParty(Myself) CombatCounter(0) !See([ENEMY])
Global("SHSK1","GLOBAL",0)
InParty("SKIE")
InParty("ELDOTH")
THEN
RESPONSE #100
RealSetGlobalTimer("SharSk","GLOBAL",2000)
SetGlobal("SHSK1","GLOBAL",1)
END

IF
InParty(Myself) CombatCounter(0) !See([ENEMY])
Global("SHSK1","GLOBAL",1)
Global("SKSH1","GLOBAL",1)
Global("ELSH1","GLOBAL",1)
InParty("SKIE")
!Dead("Skie")
InParty("ELDOTH")
!Dead("ELDOTH")
RealGlobalTimerExpired("SharSk","GLOBAL")
THEN
RESPONSE #100
SetGlobal("SHSK1","GLOBAL",2)
Interact(Player1)
END
