// --------------------------------------------
// Mod setup
// --------------------------------------------
// Basics
BACKUP ~illyria/backup~
AUTHOR ~Liam Esler (K'aeloree) - kae@spellholdstudios.net~
ASK_EVERY_COMPONENT

// Version
VERSION ~0.1~

// --------------------------------------------
// Illyria NPC mod
// --------------------------------------------
// Component setup
BEGIN ~Illyria NPC for BGII: SoA & ToB~
  REQUIRE_FILE ~data/25dialog.bif~ ~ToB is not installed! Please install the Throne of Bhaal expansion before installing Illyria.~
  REQUIRE_FILE ~data/25scripts.bif~ ~ToB is not installed! Please install the Throne of Bhaal expansion before installing Illyria.~

    
// Adds custom IsValidForPartyDialogue state used throughout Illyria
APPEND ~STATE.IDS~ // adds custom IsValidForPartyDialogue state
  ~0x80101FEF CD_STATE_NOTVALID~
  UNLESS ~CD_STATE_NOTVALID~
  

// Compiling dialogue
COMPILE ~illyria/dialogue/blk#lyr.d~
        ~illyria/dialogue/lk#lyrj.d~
        ~illyria/dialogue/lk#lyrp.d~
        ~illyria/dialogue/lk#lyrd.d~
        ~illyria/dialogue/blk#ly25.d~
        ~illyria/dialogue/lk#ly25j.d~
        ~illyria/dialogue/lk#ly25p.d~
        ~illyria/dialogue/lk#ly25d.d~


// Compiling other scripts
COMPILE ~illyria/scripts/lk#lyr.baf~
EXTEND_TOP ~ar6200.bcs~ ~illyria/scripts/ar6200.baf~


// Copying items
COPY ~illyria/items/lk#iamul.itm~ ~override~ // Amulet of Tranquillity
  SAY NAME1 ~Amulet of Tranquillity~
  SAY NAME2 ~Amulet of Tranquillity~
  SAY UNIDENTIFIED_DESC ~This grey, very faintly blue crystal is set onto a necklace which illyria wears around his neck. You notice in battle, or when in an argument, he touches it absently and seems to calm- whether this is due to some magical effect or not, you can't be sure. illyria tells you it was given to him by Balthazar, who leads the Monastery in Amkethran, upon his graduation when he began his travels.

It seems it can also cast Sanctuary, though when you try to do so, it doesn't work. illyria mentions that it was, as many of his possessions, specially created for him and will not respond to others.

This amulet is only wearable by illyria.~
  SAY DESC ~This grey, very faintly blue crystal is set onto a necklace which illyria wears around his neck. You notice in battle, or when in an argument, he touches it absently and seems to calm- whether this is due to some magical effect or not, you can't be sure. illyria tells you it was given to him by Balthazar, who leads the Monastery in Amkethran, upon his graduation when he began his travels.

It seems it can also cast Sanctuary, though when you try to do so it doesn't work. illyria mentions that it was, as many of his possessions, specially created for himself and will not respond to others.

This amulet is only wearable by illyria.~

//Copying images and creatures
COPY ~illyria/images~ ~override~

COPY ~illyria/creatures/lk#lyr.cre~ ~override~
  SAY NAME1 ~Illyria~
  SAY NAME2 ~Illyria~
  WRITE_EVALUATED_ASCII DIALOG          ~LK#IYLO~ #8
  WRITE_EVALUATED_ASCII DEATHVAR        ~illyria~ #32
  WRITE_EVALUATED_ASCII SCRIPT_OVERRIDE ~LK#IYLO~ #8
  SAY BIO ~When asked about his past, illyria' face tightens slightly, and he pauses for a moment before speaking. He tells you of his life in the Monastery; of growing up there and how he began training in the monastic way at an early age. As he grew older, he became more and more proficient, and so began to develop his own style of fighting, which he based upon the movement of the Wind Scorpion. Once he had perfected his method, he began to travel, even though he was only 17, urged by the wanderlust that most young people his age experience. He visted many places along the Sword Coast and beyond, but he returned to Amkethran for a brief break before travelling south to the Anauroch desert.
When he speaks of Anauroch his face seems to light up slightly, and the ghost of a smile flickers around the corner of his lips. He says it quickly became his home, and he spent several years travelling through the area. Eventually, his was recalled to the Monastery and was asked to travel to Saradush to await you, <CHARNAME>.
Against his will, he adds darkly, before turning away and continuing his contemplation of the sights before you.~
SAY MORALE ~<CHARNAME>, we must away - we cannot hope to win!~
SAY HAPPY ~A good deed, <CHARNAME>. Congratulations.~
SAY UNHAPPY_ANNOYED ~Are you sure this course of action is entirely wise?~
SAY UNHAPPY_SERIOUS ~If you repeat such an act, <CHARNAME>, I will be forced to take my leave of you.~
SAY UNHAPPY_BREAKING ~I cannot believe you would do such a thing... I cannot stand for such an action. Goodbye, <CHARNAME>. Perhaps we shall meet again.~
SAY LEADER ~I do not think I would make the best leader... but if you are sure, I shall try.~
SAY TIRED ~*Yawn* Is it not time to rest yet? I am weary.~
SAY BORED ~Do you have nothing BETTER to do?! Get a move on, we have things to do, places to see, people to meet!~
SAY BATTLE_CRY1 ~Do not stand in my way, or I will be forced to do you injury!~
SAY BATTLE_CRY2 ~For Sehanine!~
SAY BATTLE_CRY3 ~I will fight if I need to!~
SAY BATTLE_CRY4 ~Feel the cold edge of death before you close your eyes, fiend!~
SAY DAMAGE ~Argh!~
SAY DYING ~Sehanine, I will fly true to your arms... watch over the innocents... in times of... in times of dark... aaauuugh.~
SAY HURT ~I require healing...~
SAY AREA_FOREST ~The forest has ever been one of my favourite places... nature is a most wondrous thing.~
SAY AREA_CITY ~I do not care for cities... so much focused corruption cannot be a good thing, in any situation.~
SAY AREA_DUNGEON ~The dark here is almost comforting, in a way... yet I cannot wait to taste the air above ground once more.~
SAY AREA_DAY ~Ah, the sunrise...~
SAY AREA_NIGHT ~*Shivers* The night air is cold... and though I would not begrudge the world its heat, I wish but a little for myself.~
SAY SELECT_COMMON1 ~Mmm?~
SAY SELECT_COMMON2 ~Yes?~
SAY SELECT_COMMON3 ~Can I help you?~
SAY SELECT_COMMON4 ~What is it?~
SAY SELECT_COMMON5 ~Do you need something?~
SAY SELECT_COMMON6 ~Speak.~
SAY SELECT_ACTION1 ~Of course.~
SAY SELECT_ACTION2 ~Are you sure?~
SAY SELECT_ACTION3 ~I will begin immediately.~
SAY SELECT_ACTION4 ~Right away.~
SAY SELECT_ACTION5 ~I will strive to do so.~
SAY SELECT_ACTION6 ~I cannot guarantee success, but I will try.~
SAY SELECT_ACTION7 ~I will do as best I can.~
SAY SELECT_RARE1 ~*Sigh* Nostalgia is not always the best way to spend one's day, I suppose... to work, then.~
SAY SELECT_RARE2 ~Do you have to continually ask things of me? Can you not ask someone else?!~
SAY CRITICAL_HIT ~I WILL prevail, if this is any indication!~
SAY CRITICAL_MISS ~Damn, I missed!~
SAY TARGET_IMMUNE ~I cannot seem to affect it!~
SAY INVENTORY_FULL ~I cannot carry any more, I am not a *packhorse*!~
SAY PICKED_POCKET ~I'm not sure if this is entirely wise... what if they had seen?~
SAY HIDDEN_IN_SHADOWS ~A well-hidden enemy is a dangerous enemy.~
SAY SPELL_DISRUPTED ~Argh, my spell was disrupted!~
SAY SET_A_TRAP ~Ugh, I do not envy the victim of this trap...~


// Appends
APPEND ~pdialog.2da~  ~illyria LK#IYS LK#IYSJ LK#IYSD LK#IYLP LK#IYLJ LK#IYTD LK#IYLO~
  UNLESS ~illyria~

APPEND ~interdia.2da~ ~illyria BLK#ISO BLK#IYL~
  UNLESS ~illyria~


// Epilogues
COPY ~illyria/2da/lk#lyr1.2da~ ~override/lk#iylo1.2da~
  REPLACE ~99999~ ~Epilogue 1~

COPY ~illyria/2da/lk#iylo1.2da~ ~override/lk#iylo2.2da~
  REPLACE ~99999~ ~Epilogue 2~

COPY ~illyria/2da/lk#iylo1.2da~ ~override/lk#iylo3.2da~
  REPLACE ~99999~ ~Epilogue 3~


// Audio
COPY ~illyria/audio/lk#blank.mus~ ~music~

COPY_EXISTING ~songlist.2da~ ~override~
  SET_2DA_ENTRY 0 2 3 ~lk#blank.mus~

COPY ~illyria/audio~ ~override~


// Inline .bat-files
<<<<<<<< illyria/illyriaaudio.bat
@echo off
@echo Installing audio...

illyria\executables\oggdec.exe override\lk#i*.ogg
illyria\executables\oggdec.exe override\lk_t*.ogg
del override\lk#i*.ogg
del override\lk_t*.ogg

@echo Finished installing audio.

del illyriaaudio.bat
>>>>>>>>

<<<<<<<< illyria/illyriaaudiouninstall.bat
@echo off
@echo Uninstalling audio...

del override\lk#i*.wav
del override\lk_t*.wav
@echo Finished uninstalling audio.

del illyria\backup\illyriaaudiouninstall.bat
>>>>>>>>

COPY   ~illyria/illyriaaudio.bat~          ~illyriaaudio.bat~
COPY + ~illyria/illyriaaudiouninstall.bat~ ~illyria/backup/illyriaaudiouninstall.bat~

AT_INTERACTIVE_EXIT ~illyriaaudio.bat~
AT_UNINSTALL        ~illyria/backup/illyriaaudiouninstall.bat~