2026/01/17 Update
Removed a lot of old backup files. Fixed Eye of Gruumsh's epic bonus feats. Add Epic marker feat for Eye of Gruumsh. Added Channeled Pyroburst to prc_desc_fire.2da Added GetCurrentUnixTimestamp() function. Moved crafting conversation functions to prc_craft_cv_inc.nss. Made Midnight Augment work slightly better, still not quite per PnP yet. Disciple of Asmodeus' Summoned Devils are supposed to be Lawful Evil. Every instance of ItemPropertySpellImmunitySpecific() in race_skin.nss was misconfigured. Several instances of ItemPropertyDamageImmunity() in race_skin.nss were misconfigured. Fixed issue where Blighters were still considered undead after leaving undead wildshape. PRC8 now supports offline PnP magical crafting. Disciple of Asmodeus' Dread Night now increases AC instead of Damage, per PnP. Non-spellcaster Disciples of Asmodeus have a Hellcat duration based on DoA class level. Hexblade's Dark Companion shouldn't lose Sacntuary when loading from a save. Claws of the Savage should increase size properly if caster already has claws at time of casting.
This commit is contained in:
@@ -9,6 +9,107 @@
|
||||
#include "shd_inc_myst"
|
||||
#include "prc_inc_template"
|
||||
#include "prc_inc_factotum"
|
||||
#include "inc_persistsql"
|
||||
#include "prc_craft_cv_inc"
|
||||
|
||||
//:: Restore crafting state on login with offline time calculation
|
||||
void RestoreCraftingStateOnLogin(object oPC)
|
||||
{
|
||||
if(DEBUG) DoDebug("DEBUG: RestoreCraftingStateOnLogin called for " + GetName(oPC));
|
||||
|
||||
// Check switch conditions
|
||||
if(!(!GetPRCSwitch(PRC_DISABLE_CRAFT) &&
|
||||
GetPRCSwitch(PRC_CRAFTING_TIME_SCALE) > 1))
|
||||
{
|
||||
if(DEBUG) DoDebug("DEBUG: Switch conditions not met for crafting restore");
|
||||
return;
|
||||
}
|
||||
|
||||
if(DEBUG) DoDebug("DEBUG: Switch conditions met, checking for saved crafting state");
|
||||
|
||||
if(SQLocalsPlayer_GetInt(oPC, "crafting_active"))
|
||||
{
|
||||
if(DEBUG) DoDebug("DEBUG: Found active crafting state, restoring...");
|
||||
|
||||
// Get basic crafting state
|
||||
string sUUID = SQLocalsPlayer_GetString(oPC, "crafting_item_uuid");
|
||||
int nRounds = SQLocalsPlayer_GetInt(oPC, "crafting_rounds");
|
||||
int nCost = SQLocalsPlayer_GetInt(oPC, "crafting_cost");
|
||||
int nXP = SQLocalsPlayer_GetInt(oPC, "crafting_xp");
|
||||
string sFile = SQLocalsPlayer_GetString(oPC, "crafting_file");
|
||||
int nLine = SQLocalsPlayer_GetInt(oPC, "crafting_line");
|
||||
int nIPType = SQLocalsPlayer_GetInt(oPC, "crafting_ip_type");
|
||||
int nIPSubtype = SQLocalsPlayer_GetInt(oPC, "crafting_ip_subtype");
|
||||
int nIPCostTable = SQLocalsPlayer_GetInt(oPC, "crafting_ip_costtable");
|
||||
int nIPParam1 = SQLocalsPlayer_GetInt(oPC, "crafting_ip_param1");
|
||||
|
||||
if(DEBUG) DoDebug("DEBUG: Initial data - UUID: " + sUUID + ", rounds: " + IntToString(nRounds) +
|
||||
", cost: " + IntToString(nCost) + ", xp: " + IntToString(nXP));
|
||||
|
||||
// Calculate offline progress
|
||||
int nLogoutTime = SQLocalsPlayer_GetInt(oPC, "crafting_last_timestamp");
|
||||
int nCurrentTime = GetCurrentUnixTimestamp();
|
||||
if(DEBUG) DoDebug("prc_onenter >> : RestoreCraftingStateOnLogin() | GetCurrentUnixTimestamp is:" + IntToString(nCurrentTime) +".");
|
||||
|
||||
if(nLogoutTime > 0 && nCurrentTime > nLogoutTime)
|
||||
{
|
||||
// Calculate real time elapsed in seconds
|
||||
int nSecondsOffline = nCurrentTime - nLogoutTime;
|
||||
if(DEBUG) DoDebug("prc_onenter >> : RestoreCraftingStateOnLogin() | nSecondsOffline is:" + IntToString(nSecondsOffline) +".");
|
||||
|
||||
// Each round is always 6 seconds real time
|
||||
int nRoundsOffline = nSecondsOffline / 6;
|
||||
if(DEBUG) DoDebug("prc_onenter >> : RestoreCraftingStateOnLogin() | nRoundsOffline is:" + IntToString(nRoundsOffline) +".");
|
||||
|
||||
// Subtract offline progress from remaining rounds
|
||||
nRounds -= nRoundsOffline;
|
||||
if(nRounds < 1) nRounds = 1; // Minimum 1 round to finish
|
||||
|
||||
if(DEBUG) DoDebug("DEBUG: Offline progress - time diff: " + IntToString(nSecondsOffline) +
|
||||
"s, rounds progress: " + IntToString(nRoundsOffline) +
|
||||
", new rounds: " + IntToString(nRounds));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(DEBUG) DoDebug("DEBUG: No valid logout time found, using saved rounds: " + IntToString(nRounds));
|
||||
}
|
||||
|
||||
// Find the crafting item
|
||||
object oItem = GetItemByUUID(oPC, sUUID);
|
||||
if(GetIsObjectValid(oItem))
|
||||
{
|
||||
if(DEBUG) DoDebug("DEBUG: Found item, restoring crafting session");
|
||||
|
||||
// Reconstruct the itemproperty
|
||||
itemproperty ip;
|
||||
if(nIPType > 0)
|
||||
{
|
||||
ip = ConstructIP(nIPType, nIPSubtype, nIPCostTable, nIPParam1);
|
||||
}
|
||||
|
||||
if(DEBUG) DoDebug("DEBUG: About to call CraftingHB with " + IntToString(nRounds) + " rounds, cost: " + IntToString(nCost) + ", xp: " + IntToString(nXP));
|
||||
|
||||
// Notify player
|
||||
FloatingTextStringOnCreature("Resuming crafting session: " + IntToString(nRounds) + " round(s) remaining", oPC);
|
||||
|
||||
// Restart the crafting heartbeat with all correct parameters
|
||||
AssignCommand(oPC, ClearAllActions(TRUE));
|
||||
SetLocalInt(oPC, "PRC_CRAFT_RESTORED", 1);
|
||||
DelayCommand(3.0, CraftingHB(oPC, oItem, ip, nCost, nXP, sFile, nLine, nRounds));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(DEBUG) DoDebug("DEBUG: Failed to find item with UUID: " + sUUID);
|
||||
FloatingTextStringOnCreature("Crafting session could not be restored - item not found", oPC);
|
||||
// Clear the invalid crafting state
|
||||
SQLocalsPlayer_SetInt(oPC, "crafting_active", 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(DEBUG) DoDebug("DEBUG: No saved crafting state found");
|
||||
}
|
||||
}
|
||||
|
||||
void RestoreForsakerAbilities(object oPC)
|
||||
{
|
||||
@@ -160,6 +261,10 @@ void main()
|
||||
//hopefully in the next update
|
||||
// -Aaon Graywolf
|
||||
object oPC = GetEnteringObject();
|
||||
|
||||
if(DEBUG) DoDebug("onEnter DEBUG: PW_LOC=" + IntToString(GetPRCSwitch(PRC_PW_LOCATION_TRACKING)) +
|
||||
" DISABLE_CRAFT=" + IntToString(GetPRCSwitch(PRC_DISABLE_CRAFT)) +
|
||||
" TIME_SCALE=" + IntToString(GetPRCSwitch(PRC_CRAFTING_TIME_SCALE)));
|
||||
|
||||
//FloatingTextStringOnCreature("PRC on enter was called", oPC, FALSE);
|
||||
|
||||
@@ -448,4 +553,17 @@ void main()
|
||||
// Start the PC HeartBeat for PC's
|
||||
if(GetIsPC(oPC))
|
||||
AssignCommand(GetModule(), ExecuteScript("prc_onhb_indiv", oPC));
|
||||
|
||||
// Only restore crafting state if PW features and PnP crafting are enabled
|
||||
if(!GetPRCSwitch(PRC_DISABLE_CRAFT) &&
|
||||
GetPRCSwitch(PRC_CRAFTING_TIME_SCALE) > 1)
|
||||
{
|
||||
if(DEBUG) DoDebug("prc_onenter: Calling RestoreCraftingStateOnLogin in 6 seconds.");
|
||||
DelayCommand(6.0, RestoreCraftingStateOnLogin(oPC));
|
||||
//if(DEBUG) DoDebug("DEBUG: About to call RestoreCraftingStateOnLogin immediately");
|
||||
//RestoreCraftingStateOnLogin(oPC);
|
||||
}
|
||||
|
||||
//:: Display PRC8 version
|
||||
FloatingTextStringOnCreature("PRC8 Version: " + PRC_VERSION, oPC, FALSE);
|
||||
}
|
||||
Reference in New Issue
Block a user