42 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

2023-08-08 16:22:17 -04:00
//::///////////////////////////////////////////////
//:: Mail - Has Mailbox
//:: mail_hasmb.nss
//:: Copyright (c) 2003 Jake E. Fitch
//:://////////////////////////////////////////////
/*
Determines if the character has a mailbox and if so, sets a variable on the Mailman.
*/
//:://////////////////////////////////////////////
//:: Created By: Jake E. Fitch (Milambus Mandragon)
//:: Created On: Jan. 6, 2004
//:://////////////////////////////////////////////
#include "mail_include"
int StartingConditional()
{
object oPC = GetPCSpeaker();
object oMailman = GetNearestObjectByTag("Mailman", oPC);
int iTotalMB = GetCampaignInt(DBName, "LastMailbox");
int iCounter;
// If its already been determined, no need to go through the mailboxes again.
if (GetLocalInt(oMailman, "mail_Mailbox") > 0) return TRUE;
// Go through each mailbox comparing its owners name and cd key to the current character.
for (iCounter = 0; iCounter <= iTotalMB; iCounter++) {
int iNameMatch = (GetName(oPC) == GetCampaignString(DBName, "MBOwner" + IntToString(iCounter)));
int iCDMatch = TRUE;
if (CDKeyCheck) iCDMatch = (GetPCPublicCDKey(oPC) == GetCampaignString(DBName, "MBCDKey" + IntToString(iCounter)));
if (iNameMatch && iCDMatch) {
SetLocalInt(oMailman, "mail_Mailbox", iCounter);
return TRUE;
}
}
return FALSE;
}