//::///////////////////////////////////////////////
//:: FileName takemarkfalse
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 9/30/2002 1:32:55 AM
//:://////////////////////////////////////////////

#include "nw_i0_tool"
#include "marktools"

void main()
{

  object oTalkingPC = GetPCSpeaker();
  object oInvItem;
  int nTeam = GetLocalInt(oTalkingPC, "m_nTeam");
  int nScore, nNumber, nHasMark;

  if(nTeam < 1) {
    return;
  }

  if(nTeam == 1) {
    nScore = GetLocalInt(OBJECT_SELF, "m_nGoodScore");
  }

  if(nTeam == 2) {
    nScore = GetLocalInt(OBJECT_SELF, "m_nEvilScore");
  }

  int nPreviousScore = nScore;

  oInvItem = GetFirstItemInInventory(oTalkingPC);

//  while (oInvItem != OBJECT_INVALID)


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

      DestroyObject(oInvItem);
      nScore = nScore + 3;
      nNumber = nNumber + 1;

      if(nTeam == 1) {
        SetLocalInt(OBJECT_SELF, "m_nGoodScore", nScore);
      } else {
        SetLocalInt(OBJECT_SELF, "m_nEvilScore", nScore);
      }

    }

    oInvItem = GetNextItemInInventory(oTalkingPC);

  }

  if(HasItem(oTalkingPC, "MarkofGamlee"))
    nHasMark = 1;
  if(HasItem(oTalkingPC, "FalseMark"))
    nHasMark = 1;
  if(HasItem(oTalkingPC, "MarkofMaro"))
    nHasMark = 1;
  if(HasItem(oTalkingPC, "MarkofZool"))
    nHasMark = 1;

  if(nHasMark == 0) {
    RemoveAllEffects(oTalkingPC);
  }

  string sPlayerName = GetName(oTalkingPC);
  string sTeam;
  string sNumber = IntToString(nNumber);
  string sScore = IntToString(nScore);

  if(nTeam == 1) {
    sTeam = "Good";
  } else {
    sTeam = "Evil";
  }

  string sSpeakScore =
  sPlayerName + " just turned in " + sNumber +
  " Marks of Oron, increasing the " + sTeam +
  " team's score to " + sScore + ".";


  ActionSpeakString(sSpeakScore, TALKVOLUME_SHOUT);
  CheckScoreForEvents(nScore, nPreviousScore, nTeam, sTeam);
}
