

#include "bleeding_config"

void main()
{


  object oPC = GetEnteringObject();
  object oInvItem;
  int nPCxp = GetXP(oPC);

    if (GetLocalInt(oPC, "Initialized")) {
        int iLastHP;

        if (GetLocalInt(oPC, "PlayerHealth") == PC_HEALTH_DYING) {
            // They left while bleeding so just make em dead
            iLastHP = -10;
        }
        else {
            // Set them back to whatever HitPoints they had when they left...
            iLastHP = GetLocalInt(oPC, "LastHitPoints");
        }

        effect eDamage = EffectDamage(GetCurrentHitPoints(oPC) - iLastHP, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_FIVE);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC);

    }
    else {
        // First time they signed on
        SetLocalInt(oPC, "Initialized", TRUE);
        SetLocalInt(oPC, "LastHitPoints", GetCurrentHitPoints(oPC));
        if(nPCxp == 0) {
          CreateItemOnObject("noobsguidetoeter", oPC);
          CreateItemOnObject("readme", oPC);
        }
//        CreateItemOnObject("anotheritemchang", oPC);
        oInvItem = GetFirstItemInInventory(oPC);

//        while (GetIsObjectValid(oInvItem) != 0)
//        {
//          if (GetTag(oInvItem) == "nw_it_mbelt012") {

//            DestroyObject(oInvItem);
//            GiveGoldToCreature(oPC, 10000);

//          }
//          if (GetTag(oInvItem) == "nw_it_mbelt013") {

//            DestroyObject(oInvItem);
//            GiveGoldToCreature(oPC, 10000);

//          }
//          if (GetTag(oInvItem) == "nw_it_mbelt014") {

//            DestroyObject(oInvItem);
//            GiveGoldToCreature(oPC, 10000);

//          }
//          if (GetTag(oInvItem) == "nw_it_mbelt015") {

//            DestroyObject(oInvItem);
//            GiveGoldToCreature(oPC, 10000);

//          }
//          if (GetTag(oInvItem) == "nw_it_mring002") {

//            DestroyObject(oInvItem);
//            GiveGoldToCreature(oPC, 10000);

//          }
//          if (GetTag(oInvItem) == "nw_it_mring030") {

//            DestroyObject(oInvItem);
//            GiveGoldToCreature(oPC, 10000);

//          }
//          if (GetTag(oInvItem) == "nw_ashmlw006") {

//            DestroyObject(oInvItem);
//            GiveGoldToCreature(oPC, 10000);

//          }
//          if (GetTag(oInvItem) == "UrlsmasRing") {

//            DestroyObject(oInvItem);
//            GiveGoldToCreature(oPC, 10000);

//          }
//          if (GetTag(oInvItem) == "UrlsmasGreaterRing") {

//            DestroyObject(oInvItem);
//            GiveGoldToCreature(oPC, 10000);

//          }

//        }
//        oInvItem = GetNextItemInInventory(oPC);

    }

}


