Initial Upload
Initial Upload
This commit is contained in:
129
_module/nss/asg_resdesk_01.nss
Normal file
129
_module/nss/asg_resdesk_01.nss
Normal file
@@ -0,0 +1,129 @@
|
||||
#include "nw_o0_itemmaker"
|
||||
int DEBUG = FALSE;
|
||||
|
||||
string sMid(string sString, int iStart,int iChars)
|
||||
{
|
||||
string sCut1;
|
||||
string sCut2;
|
||||
string sReturn;
|
||||
int iCut = iStart+iChars;
|
||||
sCut1 = GetStringLeft(sString,iCut);
|
||||
sCut2 = GetStringRight(sCut1,iChars);
|
||||
sReturn = sCut2;
|
||||
// ** No checks on this one
|
||||
|
||||
return sReturn;
|
||||
}
|
||||
string sEnd(string sString, int iStart)
|
||||
{
|
||||
string sCut1;
|
||||
string sCut2;
|
||||
string sReturn;
|
||||
int iLength = GetStringLength(sString);
|
||||
int iChars = iLength-iStart;
|
||||
int iCut = iStart+iChars;
|
||||
sCut1 = GetStringLeft(sString,iCut);
|
||||
sCut2 = GetStringRight(sCut1,iChars);
|
||||
sReturn = sCut2;
|
||||
// ** No checks on this one
|
||||
|
||||
return sReturn;
|
||||
}
|
||||
void main()
|
||||
{
|
||||
|
||||
// ASG_ArcaneBookofBelts
|
||||
object oLecturn =GetNearestObjectByTag("ASG_LECTURN");
|
||||
object oSelf = OBJECT_SELF;
|
||||
object oPC = GetPCSpeaker();
|
||||
string sToken = "DEBUG: ERROR";
|
||||
object oChest;
|
||||
int iContinue = FALSE;
|
||||
if (GetIsObjectValid(oLecturn))
|
||||
{
|
||||
object oItem = GetFirstItemInInventory(oLecturn);
|
||||
// ASG_ArcaneBookofBelts
|
||||
if (GetIsObjectValid(oItem))
|
||||
{
|
||||
string sTag = GetTag(oItem);
|
||||
string sLeft3 = GetStringLeft(sTag,3);
|
||||
string sArDiv;
|
||||
if (sLeft3=="RBK")
|
||||
{
|
||||
sLeft3 = sEnd(sTag,4);
|
||||
sArDiv = sMid(sLeft3,4,3);
|
||||
if (DEBUG==TRUE)
|
||||
{
|
||||
SendMessageToPC(oPC,"DEBUG: sLeft3 = "+sLeft3);
|
||||
SendMessageToPC(oPC,"DEBUG: sArDiv = "+sArDiv);
|
||||
}
|
||||
|
||||
sTag = sLeft3;
|
||||
oChest = GetObjectByTag(sTag);
|
||||
sToken = GetName(oItem);
|
||||
if (sArDiv=="ARC") SetLocalString(OBJECT_SELF,"ASG_MIC_MAGICTYPE","A");
|
||||
else SetLocalString(OBJECT_SELF,"ASG_MIC_MAGICTYPE","D");
|
||||
}
|
||||
// Check if Object is now valid
|
||||
if (GetIsObjectValid(oChest))
|
||||
{
|
||||
if (GetIsObjectValid(oChest))
|
||||
{
|
||||
// Create List
|
||||
int iIndex = 0;
|
||||
object oItem = GetFirstItemInInventory(oChest);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
// Check to make sure the item is ID
|
||||
int iID = GetIdentified(oItem); if (iID!=TRUE) SetIdentified(oItem,TRUE);
|
||||
SetLocalArrayString(OBJECT_SELF,"ASG_MIC_ITEMNAME",iIndex,GetName(oItem));
|
||||
SetLocalArrayString(OBJECT_SELF,"ASG_MIC_ITEMTAG",iIndex,GetTag(oItem));
|
||||
iIndex++;
|
||||
oItem = GetNextItemInInventory(oChest);
|
||||
}
|
||||
SetLocalObject(OBJECT_SELF,"ASG_MIC_CHEST",oChest);
|
||||
SetLocalInt(OBJECT_SELF,"ASG_MIC_TOTALLIST",iIndex);
|
||||
SetLocalInt(OBJECT_SELF,"ASG_MIC_CURRENTLISTPOINT",0);
|
||||
|
||||
// Research Type Strings
|
||||
// (A) Any Arcane Caster
|
||||
// ( D) Any Divine Caster
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToPC(oPC,"ERROR - Magic Item Storage Chest Not Valid");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SetCustomToken(1970001,sToken);
|
||||
int iBonus = 0;
|
||||
object oLibrary = GetNearestObjectByTag("ASG_BOOKSHELF",OBJECT_SELF);
|
||||
if (GetIsObjectValid(oLibrary))
|
||||
{
|
||||
float fDist = GetDistanceBetween(OBJECT_SELF,oLibrary);
|
||||
if (fDist<10.0)
|
||||
{
|
||||
object oBooks = GetFirstItemInInventory(oLibrary);
|
||||
int iType;
|
||||
string sLeft3;
|
||||
while (GetIsObjectValid(oBooks))
|
||||
{
|
||||
iType = GetBaseItemType(oBooks);
|
||||
if (iType == BASE_ITEM_BOOK)
|
||||
{
|
||||
if (GetStringLeft(GetTag(oBooks),3)=="RBK")
|
||||
{
|
||||
iBonus=iBonus+1;
|
||||
}
|
||||
iBonus++;
|
||||
}
|
||||
oBooks = GetNextItemInInventory(oLibrary);
|
||||
}
|
||||
}
|
||||
}
|
||||
// SetLocalInt(OBJECT_SELF,"ASG_MIC_RESEARCHBONUS",iBonus);
|
||||
SendMessageToPC(oPC,"*******************************");
|
||||
// SendMessageToPC(oPC,"Enchanted Forge/Alter Level Bonus : "+IntToString(iBonus));
|
||||
}
|
Reference in New Issue
Block a user