Added Skullkeep Mystic Forge / Combine system., modified to use a single forge and combine for all item types. Added new Magesmith shop & NPC in Town of Ascension. Full compile. Updated release archive.
40 lines
1.4 KiB
Plaintext
40 lines
1.4 KiB
Plaintext
// Trash can script that only destroys items placed in the inventory
|
|
// for more than HOURS_TO_DESTROY in-game hours.
|
|
|
|
const string VAR_ITEM_TIMESTAMP = "TRASH_VINTAGE"; // Variable to store the time an item was placed
|
|
const int HOURS_TO_DESTROY = 12; // Hours an item must remain in the container
|
|
|
|
int GetCurrentGameTimeInSeconds()
|
|
{
|
|
// Get the current game time in hours, minutes, and seconds
|
|
int nHours = GetTimeHour();
|
|
int nMinutes = GetTimeMinute();
|
|
int nSeconds = GetTimeSecond();
|
|
|
|
// Convert to total seconds for easy comparison
|
|
return (nHours * 3600) + (nMinutes * 60) + nSeconds;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
object oItem = GetFirstItemInInventory(OBJECT_SELF);
|
|
int nCurrentTime = GetCurrentGameTimeInSeconds(); // Current in-game time in seconds
|
|
int nTimeThreshold = FloatToInt(HoursToSeconds(HOURS_TO_DESTROY)); // Convert hours to seconds for comparison
|
|
|
|
while (GetIsObjectValid(oItem))
|
|
{
|
|
int nItemTime = GetLocalInt(oItem, VAR_ITEM_TIMESTAMP);
|
|
|
|
// If the item has no timestamp, assign the current time
|
|
if (nItemTime == 0)
|
|
{
|
|
SetLocalInt(oItem, VAR_ITEM_TIMESTAMP, nCurrentTime);
|
|
}
|
|
else if (nCurrentTime - nItemTime >= nTimeThreshold) // Check if item has been in container for required hours
|
|
{
|
|
DestroyObject(oItem);
|
|
}
|
|
|
|
oItem = GetNextItemInInventory(OBJECT_SELF);
|
|
}
|
|
} |