// v2.1.0 - Updated for new Rez system.
//::////////////////////////////////////////////////////////////////////////////
//:: FileName:  hark_d_rez_pc_15
//::////////////////////////////////////////////////////////////////////////////
/*
   This will take the Raise Dead Scroll from the PC and drop the corpse so the
  Henchman can use the Scroll to Rez their master.
*/
//::////////////////////////////////////////////////////////////////////////////
#include "hark_i0_henlvl"
//::////////////////////////////////////////////////////////////////////////////
void main()
{
  object oPC = GetPCSpeaker();
  string sPCName = GetName(oPC);
  string sMyName = GetName(OBJECT_SELF);
  object oMaster = GetRealMaster();
  object oPCT = GetItemPossessedBy(OBJECT_SELF, "PlayerCorpse");
  object oRezScr1 = GetItemPossessedBy(oPC, "NW_IT_SPDVSCR501");
  object oRezScr2 = GetItemPossessedBy(oPC, "5RaiseDeadD_C");
  object oItem = OBJECT_INVALID;
  if (GetIsObjectValid(oRezScr1))
    { oItem = oRezScr1; }
  else if (GetIsObjectValid(oRezScr2))
    { oItem = oRezScr2; }

  if (GetIsObjectValid(oItem) && GetIsObjectValid(oPCT))
    {
     // Drop the PCT and set the locals.
     ActionPutDownItem(oPCT);
     SetLocalInt(OBJECT_SELF, HS_REZ_WAIT_CNT, 0);
     SetLocalInt(OBJECT_SELF, HS_REZ_WAITING, TRUE);
     SetLocalObject(OBJECT_SELF, HS_REZ_OFFERED, oPC);

     // Copy the scroll and destroy the original.
     object oNew = CopyItem(oItem, OBJECT_SELF);
     if (GetIsObjectValid(oNew))
       { DestroyObject(oItem); }

     // Give master some FeedBack.
     int bFeedback = GetLocalInt(GetObjectByTag(HS_VARS_OBJ), HS_VAR_REZ_FDB);
     if (bFeedback)
       { SendMessageToPC(oMaster, sMyName + REZ_MSG22 + sPCName + "."); }
    }
}
//::////////////////////////////////////////////////////////////////////////////
