Aantioch_Infernum/_module/nss/asg_rul_testopre.nss
Jaysyn904 22947ad4b6 Initial Upload
Initial Upload
2023-08-08 16:22:17 -04:00

178 lines
6.4 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name(ASG_RULE) Reaearch: Book in Lecuturn?
//:: FileName
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This works with the any Lecturn desigend for research
checks to see if lecturn is within 15m, and if a book is in it.
It does not care wich book at this time.
*/
//:://////////////////////////////////////////////
//:: Created By: Donny Wilbanks
//:: Created On: 09/07/02
//:://////////////////////////////////////////////
#include "nw_o0_itemmaker"
#include "asg_include_mics"
void main()
{
int iResult = FALSE;
object oLecturn =GetNearestObjectByTag("ASG_LECTURN");
object oSelf = OBJECT_SELF;
object oPC = GetPCSpeaker();
object oItem = GetFirstItemInInventory(oLecturn);
object oChest = GetLocalObject(OBJECT_SELF,"ASG_MIC_CHEST");
// Make sure all old ones have been cleared
SetLocalInt(OBJECT_SELF,"ASG_RESEARCH_OPTION_01",FALSE);
SetLocalInt(OBJECT_SELF,"ASG_RESEARCH_OPTION_02",FALSE);
SetLocalInt(OBJECT_SELF,"ASG_RESEARCH_OPTION_03",FALSE);
SetLocalInt(OBJECT_SELF,"ASG_RESEARCH_OPTION_04",FALSE);
SetLocalInt(OBJECT_SELF,"ASG_RESEARCH_OPTION_05",FALSE);
SetLocalInt(OBJECT_SELF,"ASG_RESEARCH_OPTION_06",FALSE);
// Test to make sure object is valid
// Load Array information
int iMaxArray = GetLocalInt(OBJECT_SELF,"ASG_MIC_TOTALLIST");
string asItemName = "ASG_MIC_ITEMNAME";
string asItemTag = "ASG_MIC_ITEMTAG";
int iContinue = TRUE;
// ** Search Area for Magical Focus
object oFocusLevel = GetNearestObjectByTag("asg_magicfocus_1",OBJECT_SELF);
int iFmod = 0;
if (GetIsObjectValid(oFocusLevel))
{
iFmod = 5;
}
else
{
oFocusLevel = GetNearestObjectByTag("asg_magicfocus_2",OBJECT_SELF);
if (GetIsObjectValid(oFocusLevel))
{
iFmod = 10;
}
else
{
oFocusLevel = GetNearestObjectByTag("asg_magicfocus_3",OBJECT_SELF);
if (GetIsObjectValid(oFocusLevel))
{
iFmod = 20;
}
else
{
oFocusLevel = GetNearestObjectByTag("asg_magicfocus_4",OBJECT_SELF);
if (GetIsObjectValid(oFocusLevel))
{
iFmod = 100;
}
else
{
oFocusLevel = GetNearestObjectByTag("asg_magicfocus_5",OBJECT_SELF);
if (GetIsObjectValid(oFocusLevel))
{
iFmod = -20;
}
}
}
}
}
// **
if (iContinue==TRUE)
{
int iCurListPoint = GetLocalInt(OBJECT_SELF,"ASG_MIC_CURRENTLISTPOINT");
if (iCurListPoint<1) iCurListPoint = 0;
int iK = iCurListPoint; if (iK>iMaxArray) iK = iMaxArray;
int iGPValue;
int iSkill_SpellCraft;
int iDC;
int iSlot = 0;
string sSlotBase = "ASG_RESEARCH_OPTION_0";
string sSlotBPBase = "ASG_BLUEPRINT_0";
string sSlot;
string sSlotBP;
string sItemName;
string sItemTag;
int iToken;
int iMlevel;
int iHD;
string sArDiv = GetLocalString(OBJECT_SELF,"ASG_MIC_MAGICTYPE");
if (sArDiv=="A")
{
iHD = GetHitDice(oPC);
}else
{
iHD = GetHitDice(oPC);
}
while (iContinue == TRUE)
{
sItemName = GetLocalArrayString(OBJECT_SELF,asItemName,iK);
sItemTag = GetLocalArrayString(OBJECT_SELF,asItemTag,iK);
object oItem = GetItemPossessedBy(oChest,sItemTag);
if (GetIsObjectValid(oItem))
{
SetIdentified(oItem,TRUE);
iGPValue = GetGoldPieceValue(oItem);
iMlevel = 1;
iMlevel = FindItemLevel(oItem);
if (iFmod<0) iMlevel = iMlevel + iFmod; else iMlevel = iMlevel - iFmod;
if (iMlevel<0) iMlevel = 1;
// FindItemLevel(object oItem)
/*
if (iGPValue>0 && iGPValue<500) iMlevel = 1;
else if (iGPValue>499 && iGPValue<750) iMlevel = 2;
else if (iGPValue>749 && iGPValue<1750) iMlevel = 3;
else if (iGPValue>1749 && iGPValue<2500) iMlevel = 4;
else if (iGPValue>2549 && iGPValue<5000) iMlevel = 5;
else if (iGPValue>4999 && iGPValue<7500) iMlevel = 6;
else if (iGPValue>7499 && iGPValue<10000) iMlevel = 7;
else if (iGPValue>9999 && iGPValue<13500) iMlevel = 8;
else if (iGPValue>13499 && iGPValue<17000) iMlevel = 9;
else if (iGPValue>16999 && iGPValue<20000) iMlevel = 10;
else if (iGPValue>19999)
{
iMlevel = 10+((iGPValue-20000)/8000);
if (iGPValue>99999) iMlevel = iGPValue/5000;
}
*/
iDC = iMlevel;
/*
int iType = GetBaseItemType(oItem);
// Check for Scrolls and Potions
if (iType == BASE_ITEM_POTIONS || iType == BASE_ITEM_SCROLL)
{
iDC = iDC * 3;
}
if (iFmod<0) iDC = iDC + (iFmod*-1);
else
{ iDC = iDC - iFmod; }
*/
iSlot++;
if (iDC<0) iDC = 1;
sSlotBP = sSlotBPBase + IntToString(iSlot);
sSlot = sSlotBase + IntToString(iSlot);
SetLocalInt(OBJECT_SELF,sSlot,TRUE);
SetLocalString(OBJECT_SELF,sSlotBP,sItemTag);
iToken = 197010+iSlot;
SetLocalInt(OBJECT_SELF,"ASG_MIC_ITEMRESEARCHCD_"+IntToString(iSlot)+"_",iDC);
SetLocalObject(OBJECT_SELF,"ASG_MIC_ITEMTOBUILD_ITEM_0"+IntToString(iSlot),oItem);
if (iHD>=iDC)
{
SetCustomToken(iToken,"[B] "+sItemName+" LV ("+IntToString(iDC)+")");
}
else
{
SetCustomToken(iToken,"[X] "+sItemName+" LV ("+IntToString(iDC)+")");
}
}
iK++; if (iSlot>5 || iK>iMaxArray) iContinue = FALSE;
}
SetLocalInt(OBJECT_SELF,"ASG_MIC_CURRENTLISTPOINT",iK);
}
// Send Player Message - Bonus
}