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.
86 lines
3.4 KiB
Plaintext
86 lines
3.4 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: OnClientLeave eventscript
|
|
//:: prc_onleave
|
|
//:://////////////////////////////////////////////
|
|
#include "prc_class_const"
|
|
#include "inc_utility"
|
|
#include "inc_persistsql"
|
|
|
|
// Save logout time when actually logging out
|
|
void SaveCraftingLogoutTime(object oPC)
|
|
{
|
|
if(DEBUG) DoDebug("SaveCraftingLogoutTime: Called for " + GetName(oPC));
|
|
|
|
// Check database first, then local int
|
|
int bCrafting = SQLocalsPlayer_GetInt(oPC, "crafting_active");
|
|
if(!bCrafting)
|
|
{
|
|
bCrafting = GetLocalInt(oPC, "PRC_CRAFT_HB");
|
|
if(DEBUG) DoDebug("SaveCraftingLogoutTime: DB crafting_active = " + IntToString(bCrafting) +
|
|
", Local PRC_CRAFT_HB = " + IntToString(GetLocalInt(oPC, "PRC_CRAFT_HB")));
|
|
}
|
|
|
|
if(bCrafting)
|
|
{
|
|
// Save the logout timestamp with fallback
|
|
int nLogoutTimestamp = GetCurrentUnixTimestamp();
|
|
if(DEBUG) DoDebug("prc_onleave >> SaveCraftingLogoutTime | nLogoutTimestamp is: " + IntToString(nLogoutTimestamp));
|
|
|
|
if(nLogoutTimestamp == 0)
|
|
{
|
|
// Fallback: use a simple counter
|
|
int nLastLogout = SQLocalsPlayer_GetInt(oPC, "crafting_last_timestamp");
|
|
nLogoutTimestamp = nLastLogout + 1;
|
|
SQLocalsPlayer_SetInt(oPC, "crafting_last_timestamp", nLogoutTimestamp);
|
|
if(DEBUG) DoDebug("SaveCraftingLogoutTime: Using fallback counter: " + IntToString(nLogoutTimestamp));
|
|
}
|
|
|
|
// Save the timestamp
|
|
SQLocalsPlayer_SetInt(oPC, "crafting_last_timestamp", nLogoutTimestamp);
|
|
|
|
// Save current rounds remaining
|
|
int nRounds = GetLocalInt(oPC, "PRC_CRAFT_TIME");
|
|
SQLocalsPlayer_SetInt(oPC, "crafting_rounds", nRounds);
|
|
|
|
// Save the crafting costs
|
|
SQLocalsPlayer_SetInt(oPC, "crafting_cost", GetLocalInt(oPC, "PRC_CRAFT_COST"));
|
|
SQLocalsPlayer_SetInt(oPC, "crafting_xp", GetLocalInt(oPC, "PRC_CRAFT_XP"));
|
|
|
|
if(nRounds > 0)
|
|
{
|
|
SQLocalsPlayer_SetInt(oPC, "crafting_rounds", nRounds);
|
|
}
|
|
|
|
if(DEBUG) DoDebug("SaveCraftingLogoutTime: Saved logout timestamp " + IntToString(nLogoutTimestamp) + ", rounds remaining: " + IntToString(nRounds));
|
|
|
|
SQLocalsPlayer_SetString(oPC, "crafting_file", GetLocalString(oPC, "PRC_CRAFT_FILE"));
|
|
SQLocalsPlayer_SetInt(oPC, "crafting_line", GetLocalInt(oPC, "PRC_CRAFT_LINE"));
|
|
|
|
// Remove concentration monitoring and clear heartbeat
|
|
RemoveEventScript(oPC, EVENT_VIRTUAL_ONDAMAGED, "prc_od_conc");
|
|
DeleteLocalInt(oPC, "PRC_CRAFT_HB");
|
|
}
|
|
else
|
|
{
|
|
if(DEBUG) DoDebug("SaveCraftingLogoutTime: Player not crafting, skipping");
|
|
}
|
|
}
|
|
void main()
|
|
{
|
|
//:: Execute scripts hooked to this event for the player triggering it
|
|
object oPC = GetExitingObject();
|
|
string sPCName = GetName(oPC);
|
|
|
|
if (oPC == OBJECT_INVALID)
|
|
{
|
|
DoDebug("prc_onleave: oPC "+sPCName+" is invalid");
|
|
return;
|
|
}
|
|
|
|
if(DEBUG) DoDebug("prc_onleave: Player " +sPCName+ " leaving");
|
|
|
|
AssignCommand(GetModule(), DelayCommand(0.1, RecalculateTime()));
|
|
//SaveCraftingLogoutTime(oPC);
|
|
ExecuteAllScriptsHookedToEvent(oPC, EVENT_ONCLIENTLEAVE);
|
|
}
|