Files
Anphillia_PRC8/_module/nss/eye_scalp_inc.nss
Jaysyn904 28cdb617b3 Initial commit
Adding all of the current content for Anphillia Unlimited.
2024-01-04 07:49:38 -05:00

98 lines
2.5 KiB
Plaintext

#include "anph_inc"
string GetScalpFaction(object oScalp)
{
string sScalpTag = GetTag(oScalp);
string sScalpFaction1 = GetStringLeft(sScalpTag, GetStringLength(sScalpTag) - 5);
string sScalpFaction = GetStringRight(sScalpFaction1, GetStringLength(sScalpFaction1) - 4);
return sScalpFaction;
}
int GetScalpAlignment(object oScalp)
{
string sScalpTag = GetTag(oScalp);
string sScalpAlign = GetStringRight(sScalpTag, 1);
if (sScalpAlign == "G")
{
return (ALIGNMENT_GOOD);
}
else if (sScalpAlign == "E")
{
return (ALIGNMENT_EVIL);
}
else if (sScalpAlign == "N")
{
return (ALIGNMENT_NEUTRAL);
}
else
{
return (-1);
}
}
int GetScalpLevel(object oScalp)
{
string sScalpTag = GetTag(oScalp);
int iScalpLevel;
string sScalpLevel1 = GetStringRight(sScalpTag, 4);
string sScalpLevel = GetStringLeft(sScalpLevel1, 2);
if (GetStringLeft(sScalpLevel, 1) == "0")
{
iScalpLevel = StringToInt(GetStringRight(sScalpLevel, 1));
}
else
{
iScalpLevel = StringToInt(sScalpLevel);
}
return iScalpLevel;
}
int GetHasScalpInInventory(object oPC, object oContainer = OBJECT_INVALID)
{
if (oContainer == OBJECT_INVALID) oContainer = oPC;
object oItem = GetFirstItemInInventory(oContainer);
int iHasScalp = FALSE;
int iIsContainer = FALSE;
if (oPC != oContainer)
iIsContainer = TRUE;
while(GetIsObjectValid(oItem) &&
iHasScalp == FALSE)
{
if (GetHasInventory(oItem))
{
GetHasScalpInInventory(oPC, oItem);
}
else if (GetStringLowerCase(GetStringLeft(GetTag(oItem), 4)) == "scp_" &&
AnphGetPlayerTeam(oPC) != GetScalpFaction(oItem))
{
iHasScalp = TRUE;
}
oItem = GetNextItemInInventory(oContainer);
}
return iHasScalp;
}
void PayForEnemyScalps(object oPC, object oContainer = OBJECT_INVALID)
{
if (oContainer == OBJECT_INVALID) oContainer = oPC;
object oItem = GetFirstItemInInventory(oContainer);
int iIsContainer = FALSE;
if (oPC != oContainer)
iIsContainer = TRUE;
while(GetIsObjectValid(oItem))
{
if (GetHasInventory(oItem))
{
GetHasScalpInInventory(oPC, oItem);
}
else if (GetStringLowerCase(GetStringLeft(GetTag(oItem), 4)) == "scp_" &&
AnphGetPlayerTeam(oPC) != GetScalpFaction(oItem))
{
GiveGoldToCreature(oPC, 80 * GetScalpLevel(oItem));
GiveXPToCreature(oPC, 20 * GetScalpLevel(oItem));
DestroyObject(oItem);
}
oItem = GetNextItemInInventory(oContainer);
}
}