generated from Jaysyn/ModuleTemplate
2025/08/24 Update
Updated for PRC8 updates.
This commit is contained in:
@@ -104,8 +104,81 @@ string GetAMSDefinitionFileName(int nClass);
|
||||
//////////////////////////////////////////////////
|
||||
/* Internal functions */
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
object _inc_lookups_GetCacheObject(string sTag)
|
||||
{
|
||||
if(DEBUG) DoDebug("_inc_lookups_GetCacheObject: Looking for waypoint with tag: " + sTag);
|
||||
object oWP = GetObjectByTag(sTag);
|
||||
if(GetIsObjectValid(oWP))
|
||||
{
|
||||
if(DEBUG) DoDebug("_inc_lookups_GetCacheObject: Found existing waypoint: " + sTag);
|
||||
return oWP;
|
||||
}
|
||||
|
||||
if(DEBUG) DoDebug("_inc_lookups_GetCacheObject: Waypoint not found, creating new token...");
|
||||
|
||||
object oChest = GetObjectByTag("Bioware2DACache");
|
||||
if(!GetIsObjectValid(oChest))
|
||||
{
|
||||
if(DEBUG) DoDebug("_inc_lookups_GetCacheObject: Bioware2DACache object not found, creating near HEARTOFCHAOS...");
|
||||
oChest = CreateObject(OBJECT_TYPE_CREATURE, "prc_2da_cache",
|
||||
GetLocation(GetObjectByTag("HEARTOFCHAOS")), FALSE, "Bioware2DACache");
|
||||
}
|
||||
|
||||
if(!GetIsObjectValid(oChest))
|
||||
{
|
||||
if(DEBUG) DoDebug("_inc_lookups_GetCacheObject: Failed, creating Bioware2DACache at starting location...");
|
||||
oChest = CreateObject(OBJECT_TYPE_CREATURE, "prc_2da_cache",
|
||||
GetStartingLocation(), FALSE, "Bioware2DACache");
|
||||
}
|
||||
|
||||
if(!GetIsObjectValid(oChest))
|
||||
{
|
||||
DoDebug("_inc_lookups_GetCacheObject: ERROR - Could not create Bioware2DACache!");
|
||||
return OBJECT_INVALID;
|
||||
}
|
||||
|
||||
int nContainer = 0;
|
||||
string sContainerName = "Bio2DACacheTokenContainer_Lkup_";
|
||||
object oContainer = GetObjectByTag(sContainerName + IntToString(nContainer));
|
||||
|
||||
if(GetIsObjectValid(oContainer))
|
||||
{
|
||||
nContainer = GetLocalInt(oContainer, "ContainerCount");
|
||||
oContainer = GetObjectByTag(sContainerName + IntToString(nContainer));
|
||||
if(GetLocalInt(oContainer, "NumTokensInside") >= 34)
|
||||
{
|
||||
if(DEBUG) DoDebug("_inc_lookups_GetCacheObject: Container full, creating new container...");
|
||||
oContainer = OBJECT_INVALID;
|
||||
++nContainer;
|
||||
}
|
||||
}
|
||||
|
||||
if(!GetIsObjectValid(oContainer))
|
||||
{
|
||||
if(DEBUG) DoDebug("_inc_lookups_GetCacheObject: Creating container: " + sContainerName + IntToString(nContainer));
|
||||
oContainer = CreateObject(OBJECT_TYPE_ITEM, "nw_it_contain001", GetLocation(oChest), FALSE, sContainerName + IntToString(nContainer));
|
||||
DestroyObject(oContainer);
|
||||
oContainer = CopyObject(oContainer, GetLocation(oChest), oChest, sContainerName + IntToString(nContainer));
|
||||
if(nContainer)
|
||||
SetLocalInt(GetObjectByTag(sContainerName + "0"), "ContainerCount", nContainer);
|
||||
}
|
||||
|
||||
if(DEBUG) DoDebug("_inc_lookups_GetCacheObject: Creating token: " + sTag);
|
||||
oWP = CreateItemOnObject("hidetoken", oContainer, 1, sTag);
|
||||
SetLocalInt(oContainer, "NumTokensInside", GetLocalInt(oContainer, "NumTokensInside") + 1);
|
||||
|
||||
if(!GetIsObjectValid(oWP))
|
||||
{
|
||||
DoDebug("_inc_lookups_GetCacheObject: ERROR - Failed to create lookup storage token for " + sTag);
|
||||
return OBJECT_INVALID;
|
||||
}
|
||||
|
||||
if(DEBUG) DoDebug("_inc_lookups_GetCacheObject: Successfully created token: " + sTag);
|
||||
return oWP;
|
||||
}
|
||||
|
||||
|
||||
/* object _inc_lookups_GetCacheObject(string sTag)
|
||||
{
|
||||
object oWP = GetObjectByTag(sTag);
|
||||
if(!GetIsObjectValid(oWP))
|
||||
@@ -171,6 +244,7 @@ object _inc_lookups_GetCacheObject(string sTag)
|
||||
|
||||
return oWP;
|
||||
}
|
||||
*/
|
||||
|
||||
void SetLkupStage(int nStage, object oModule, int nClass, string sFile)
|
||||
{
|
||||
@@ -242,7 +316,7 @@ void SetupLookupStage(object oMod, int n)
|
||||
case 11: SetLkupStage(n, oMod, CLASS_TYPE_DRAGON_SHAMAN, "cls_inv_drgshm"); break;
|
||||
case 12: SetLkupStage(n, oMod, CLASS_TYPE_WARLOCK, "cls_inv_warlok"); break;
|
||||
case 13: SetLkupStage(n, oMod, CLASS_TYPE_ARCHIVIST, "cls_spell_archv"); break;
|
||||
case 14: SetLkupStage(n, oMod, CLASS_TYPE_ASSASSIN, "cls_spell_asasin"); break;
|
||||
//case 14: SetLkupStage(n, oMod, CLASS_TYPE_ASSASSIN, "cls_spell_asasin"); break;
|
||||
case 15: SetLkupStage(n, oMod, CLASS_TYPE_BARD, "cls_spell_bard"); break;
|
||||
case 16: SetLkupStage(n, oMod, CLASS_TYPE_BEGUILER, "cls_spell_beguil"); break;
|
||||
case 17: SetLkupStage(n, oMod, CLASS_TYPE_DREAD_NECROMANCER, "cls_spell_dnecro"); break;
|
||||
@@ -524,14 +598,50 @@ int GetClassFeatFromPower(int nPowerID, int nClass)
|
||||
|
||||
int SpellToSpellbookID(int nSpell)
|
||||
{
|
||||
// Fetch the lookup object
|
||||
object oWP = GetObjectByTag("PRC_GetRowFromSpellID");
|
||||
int nOutSpellID = GetLocalInt(oWP, /*"PRC_GetRowFromSpellID_" + */IntToString(nSpell));
|
||||
|
||||
// Sanity check for the object
|
||||
if(oWP == OBJECT_INVALID)
|
||||
{
|
||||
if(DEBUG) DoDebug("inc_lookup >> SpellToSpellbookID: Lookup object PRC_GetRowFromSpellID is INVALID!");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(DEBUG) DoDebug("inc_lookup >> SpellToSpellbookID: Object valid: TRUE");
|
||||
}
|
||||
|
||||
// Attempt to retrieve the local int for this spell
|
||||
string sKey = IntToString(nSpell);
|
||||
int nOutSpellID = GetLocalInt(oWP, sKey);
|
||||
|
||||
if(DEBUG) DoDebug("inc_lookup >> SpellToSpellbookID: Looking up key: " + sKey);
|
||||
if(DEBUG) DoDebug("inc_lookup >> SpellToSpellbookID: Retrieved value: " + IntToString(nOutSpellID));
|
||||
|
||||
// Handle missing values
|
||||
if(nOutSpellID == 0)
|
||||
{
|
||||
if(DEBUG) DoDebug("inc_lookup >> SpellToSpellbookID: No value found for spell, returning -1");
|
||||
nOutSpellID = -1;
|
||||
//if(DEBUG) DoDebug("SpellToSpellbookID(" + IntToString(nSpell) + ", " + sFile + ") = " + IntToString(nOutSpellID));
|
||||
}
|
||||
|
||||
if(DEBUG) DoDebug("inc_lookup >> SpellToSpellbookID: Final nOutSpellID: " + IntToString(nOutSpellID));
|
||||
|
||||
return nOutSpellID;
|
||||
}
|
||||
|
||||
|
||||
/* int SpellToSpellbookID(int nSpell)
|
||||
{
|
||||
object oWP = GetObjectByTag("PRC_GetRowFromSpellID");
|
||||
int nOutSpellID = GetLocalInt(oWP, /*"PRC_GetRowFromSpellID_" + *///IntToString(nSpell));
|
||||
/* if(nOutSpellID == 0)
|
||||
nOutSpellID = -1;
|
||||
if(DEBUG) DoDebug("inc_lookup >> SpellToSpellbookID: (nSpell: " + IntToString(nSpell) + ") = nOutSpellID: " + IntToString(nOutSpellID));
|
||||
return nOutSpellID;
|
||||
} */
|
||||
|
||||
int RealSpellToSpellbookID(int nClass, int nSpell)
|
||||
{
|
||||
object oWP = GetObjectByTag("PRC_GetRowFromRealSpellID");
|
||||
|
||||
Reference in New Issue
Block a user