#include "nw_i0_plot"
#include "utl_i_sqluuid"

void main()
{
int iLevel;
int iDeaths;
int iDeathAllowed;
int iXPPrice;
int iGPPrice;
string sDestTag;
string sMsg;
object oPC;
object oSpawnPoint;

oPC = GetPCSpeaker();
if (SQLocalsUUID_GetInt(oPC,"ModRank") == 1)
    SendMessageToPC(oPC,"You are no longer eligible for campaign ranking...");
SQLocalsUUID_SetInt(oPC,"ModRank",0);
iLevel = GetHitDice(oPC);

iDeaths = SQLocalsUUID_GetInt(oPC,"PCDeaths");
iDeathAllowed = 3 + iLevel - SQLocalsUUID_GetInt(oPC,"PCEnterLevel");

iXPPrice = iLevel * 200 + (iDeaths-iDeathAllowed) * 200;

sMsg = "You have paid the price for life.";
SendMessageToPC(oPC,sMsg);

SetXP(oPC,GetXP(oPC) - iXPPrice);

if (SQLocalsUUID_GetInt(oPC,"Monstrous") == 0 && SQLocalsUUID_GetInt(oPC,"EvilPath") == 0)
    sDestTag = "EN4_Respawn";
else
    sDestTag="EN4_MERespawn";

oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oPC,JumpToLocation(GetLocation(oSpawnPoint)));

}