//::///////////////////////////////////////////////
//:: Default:On Death
//:: NW_C2_DEFAULT7
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Shouts to allies that they have been killed
    Burns inn and kills occupants
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 25, 2001
//:: Modified By: Dalantriel Jul 22, 2002
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"

void main()
{
    int nClass = GetLevelByClass(CLASS_TYPE_COMMONER);
    int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
    if(nClass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
    {
        object oKiller = GetLastKiller();
        AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);
    }

    SpeakString("NW_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
    //Shout Attack my target, only works with the On Spawn In setup
    SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
    if(GetSpawnInCondition(NW_FLAG_DEATH_EVENT))
    {
        SignalEvent(OBJECT_SELF, EventUserDefined(1007));
    }

// Burn the inn
// Add flames and sound to exterior of inn

    location loc;

    object oflame = GetObjectByTag("inn_f1");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);

    oflame = GetObjectByTag("inn_f2");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);

    oflame = GetObjectByTag("inn_f3");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);

    oflame = GetObjectByTag("inn_f4");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);

    oflame = GetObjectByTag("inn_f5");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);

    oflame = GetObjectByTag("inn_f6");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);

    SoundObjectPlay(GetObjectByTag("FireInn"));
    SoundObjectPlay(GetObjectByTag("FireInn2"));

// Destroy all occupants and replace with flames

    oflame = GetObjectByTag("NW_COMFEMALE");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);
    DestroyObject(GetObjectByTag("NW_COMFEMALE"));

    oflame = GetObjectByTag("NW_FEMALEKID01");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);
    DestroyObject(GetObjectByTag("NW_FEMALEKID01"));

    oflame = GetObjectByTag("NW_MALEKID01");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);
    DestroyObject(GetObjectByTag("NW_MALEKID01"));

    oflame = GetObjectByTag("Dili");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);
    DestroyObject(GetObjectByTag("Dili"));

    oflame = GetObjectByTag("NW_NOBLFEMALE");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);
    DestroyObject(GetObjectByTag("NW_NOBLFEMALE"));

    oflame = GetObjectByTag("NW_OLDWOMAN");
    loc = GetLocation(oflame);
    CreateObject(OBJECT_TYPE_PLACEABLE, "flamelarge", loc, TRUE);
    DestroyObject(GetObjectByTag("NW_OLDWOMAN"));

}
