BEGIN ~TCSANBAL~

IF ~NumberOfTimesTalkedTo(0)~ THEN BEGIN San0
  SAY ~Just a few more barrels men.  Then we will be done for the night.~
  IF ~~ THEN EXTERN ~TCPIRATE~ BigLoad
END

IF ~~ THEN BEGIN San1
  SAY ~What th--~
  IF ~InParty("TCNED")~ THEN GOTO San2
  IF ~!InParty("TCNED") InParty("TCPARA") !StateCheck("TCPARA",CD_STATE_NOTVALID)~ THEN GOTO San3
  IF ~!InParty("TCNED") OR(2) !InParty("TCPARA") StateCheck("TCPARA",CD_STATE_NOTVALID)~ THEN GOTO San5
END

IF ~~ THEN BEGIN San2
  SAY ~Ned?  What are you doing with them?~
  IF ~!StateCheck("TCNED",CD_STATE_NOTVALID)~ THEN REPLY ~Ned, do you know these smugglers?~ EXTERN ~TCNEDJ~ Traitor
  IF ~StateCheck("TCNED",CD_STATE_NOTVALID)~ THEN REPLY ~Ned can't respond right now but I assume he works for you.~ DO ~ActionOverride("TCNED",LeaveParty())~ JOURNAL ~We had rescued Ned Shankshaft only to discover later that he was a spy for the leader of the smugglers.~ EXIT
END

IF ~~ THEN BEGIN San3
  SAY ~Oh yes, Ned warned us that you would be coming down here.  Attack now!~
  IF ~~ THEN EXTERN ~TCPARAJ~ WhySteal1
END

IF ~~ THEN BEGIN San4
  SAY ~What are you blathering about, elf?  Ah, Ned, you arrived.  Good, kill that elf first.~
  IF ~Global("TCNedReEquiped","GLOBAL",1)~ THEN DO ~CreateCreature("TCNED01",[2085.808],3) ActionOverride("TCNED01",Enemy()) Shout(ALERT)~ EXIT
  IF ~!Global("TCNedReEquiped","GLOBAL",1)~ THEN DO ~CreateCreature("TCNED02",[2085.808],3) Shout(ALERT)~ EXIT
END

IF ~~ THEN BEGIN San5
  SAY ~Oh yes, Ned warned us that you would be coming down here.  Attack now!~
  IF ~Global("TCNedReEquiped","GLOBAL",1)~ THEN DO ~CreateCreature("TCNED01",[2085.808],3) ActionOverride("TCNED01",Enemy()) Shout(ALERT)~ EXIT
  IF ~!Global("TCNedReEquiped","GLOBAL",1)~ THEN DO ~CreateCreature("TCNED02",[2085.808],3) Shout(ALERT)~ EXIT
END

IF ~Global("TCTalkedToSanbalet","TC0054",1)~ THEN BEGIN SanMercy0
  SAY ~I yield!  Have mercy!~
  IF ~~ THEN REPLY ~Only if you tell me everything about this operation.~ DO ~SetGlobal("TCTalkedtoSanbalet","TC0054",2)~ GOTO SanMercy1
  IF ~~ THEN REPLY ~No, you will die now.~ DO ~SetGlobal("TCTalkedtoSanbalet","TC0054",2)~ GOTO SanMercy4
END

IF ~~ THEN BEGIN SanMercy1
  SAY ~Of course!  Anything.~
  IF ~~ THEN REPLY ~Get started!~ GOTO SanMercy2
END

IF ~~ THEN BEGIN SanMercy2
  SAY ~As you can see, we are bringing in goods.~
  IF ~~ THEN REPLY ~Obviously, but to whom?~ GOTO SanMercy3
END

IF ~~ THEN BEGIN SanMercy3
  SAY ~That you will not know!  Aha! *you see a wand in his hand*~
  IF ~~ THEN DO ~ReallyForceSpell(LastTalkedToBy(),WIZARD_MAGIC_MISSILE)~ EXIT
END

IF ~~ THEN BEGIN SanMercy4
  SAY ~Fool, that was all the time I needed! *you see a wand in his hand*~
  IF ~~ THEN DO ~ReallyForceSpell(LastTalkedToBy(),WIZARD_MAGIC_MISSILE)~ EXIT
END

APPEND ~TCPIRATE~

IF ~~ THEN BEGIN BigLoad
  SAY ~Aye, thank be the gods.  'Tis a big load this time.  Er, whose that?~
  IF ~~ THEN EXTERN ~TCSANBAL~ San1
END
END

APPEND ~TCPARAJ~

IF ~~ THEN BEGIN WhySteal1
  SAY ~Why do you rob people of your own kind?  I do not understand your ways.  To steal from your people is wrong!~
  IF ~~ THEN EXTERN ~TCSANBAL~ San4
END
END

APPEND ~TCNEDJ~

IF ~~ THEN BEGIN Traitor
  SAY ~Our boss asked me to watch them.  Now that they have seen our business, it is time for them to die.~
  IF ~InParty("TCALEIGHA") !StateCheck("TCALEIGHA",CD_STATE_NOTVALID)~ THEN EXTERN ~TCALEIGJ~ AleighNedTraitor 
  IF ~OR(2) !InParty("TCALEIGHA") StateCheck("TCALEIGHA",CD_STATE_NOTVALID) InParty("TCCANDE") !StateCheck("TCCANDE",CD_STATE_NOTVALID)~ THEN EXTERN ~TCCANJ~ CandellaNedTraitor 
  IF ~OR(2) !InParty("TCALEIGHA") StateCheck("TCALEIGHA",CD_STATE_NOTVALID) OR(2) !InParty("TCCANDE") StateCheck("TCCANDE",CD_STATE_NOTVALID) InParty("TCCATH") !StateCheck("TCCATH",CD_STATE_NOTVALID)~ THEN EXTERN ~TCCATHJ~ CathNedTraitor
  IF ~OR(2) !InParty("TCALEIGHA") StateCheck("TCALEIGHA",CD_STATE_NOTVALID) OR(2) !InParty("TCCANDE") StateCheck("TCCANDE",CD_STATE_NOTVALID) OR(2) !InParty("TCCATH") StateCheck("TCCATH",CD_STATE_NOTVALID)~ THEN REPLY ~What?  You traitor!~ GOTO Traitor1
END

IF ~~ THEN BEGIN Traitor1
  SAY ~Sorry <CHARNAME>, but business is business.~
  IF ~~ THEN DO ~LeaveParty() Enemy()~ JOURNAL ~We had rescued Ned Shankshaft only to discover later that he was a spy for the leader of the smugglers.~ EXIT
END

IF ~~ THEN BEGIN Doubtfull
  SAY ~Hah!  Catharandamus, I don't think <CHARNAME> would pay my price!~
  IF ~~ THEN REPLY ~That's right Ned, you crossed the wrong person.~ EXIT
  IF ~~ THEN REPLY ~How much for you to leave right now?~ GOTO Doubtfull1
END

IF ~~ THEN BEGIN Doubtfull1
  SAY ~2,000 gold, <CHARNAME>~
  IF ~PartyGoldGT(1999)~ THEN REPLY ~Done.  Get going.~ DO ~TakePartyGold(2000) LeaveParty() EscapeArea()~ EXIT
  IF ~~ THEN REPLY ~Sorry, Ned, but paying you 2,000 gold to spare your life isn't going to happen.  Do you think I am an idiot?~ DO ~LeaveParty() Enemy() Attack(Player1)~ EXIT
END
END

APPEND ~TCALEIGJ~

IF ~~ THEN BEGIN AleighNedTraitor
  SAY ~I knew something was up.  Ned, prepare to repent for your sins!~
  IF ~~ THEN EXTERN ~TCNEDJ~ Traitor1
END
END

APPEND ~TCCANJ~

IF ~~ THEN BEGIN CandellaNedTraitor
  SAY ~Next time, <CHARNAME>, listen to me!  I told you something was wrong with him.~
  IF ~~ THEN EXTERN ~TCNEDJ~ Traitor1
END
END

APPEND ~TCCATHJ~

IF ~~ THEN BEGIN CathNedTraitor
  SAY ~Ned, wait...  We can double the offer your employers made you if you cease this pointless battle at once!~
  IF ~~ THEN EXTERN ~TCNEDJ~ Doubtfull
END
END
