Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- common/database.cpp | 0
- zone/command.cpp | 3 +++
- zone/questmgr.cpp | 2 ++
- zone/zone.cpp | 15 ++++++++++++---
- 4 files changed, 17 insertions(+), 3 deletions(-)
- diff --git a/zone/command.cpp b/zone/command.cpp
- index 3295841..bf18925 100644
- --- a/zone/command.cpp
- +++ b/zone/command.cpp
- @@ -66,6 +66,7 @@
- // these should be in the headers...
- extern WorldServer worldserver;
- extern TaskManager *taskmanager;
- +extern Zone* zone;
- void CatchSignal(int sig_num);
- #include "QuestParserCollection.h"
- @@ -9161,6 +9162,8 @@ void command_instance(Client *c, const Seperator *sep)
- uint16 id = atoi(sep->arg[2]);
- database.DeleteInstance(id);
- c->Message(0, "Destroyed instance with id %lu.", (unsigned long)id);
- + // start 20 second timer to shut down instance
- + zone->SetInstanceTimer(20000);
- }
- else if(strcasecmp(sep->arg[1], "add") == 0)
- {
- diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp
- index e018385..1b399bf 100644
- --- a/zone/questmgr.cpp
- +++ b/zone/questmgr.cpp
- @@ -2508,6 +2508,8 @@ uint16 QuestManager::CreateInstance(const char *zone, int16 version, uint32 dura
- void QuestManager::DestroyInstance(uint16 instance_id)
- {
- database.DeleteInstance(instance_id);
- + // start a 20 second shutdown clock for the instance.
- + zone->SetInstanceTimer(20000);
- }
- uint16 QuestManager::GetInstanceID(const char *zone, int16 version)
- diff --git a/zone/zone.cpp b/zone/zone.cpp
- index 487bda5..6b697d5 100644
- --- a/zone/zone.cpp
- +++ b/zone/zone.cpp
- @@ -1505,13 +1505,22 @@ bool Zone::HasWeather()
- }
- void Zone::StartShutdownTimer(uint32 set_time) {
- - if (set_time > autoshutdown_timer.GetRemainingTime()) {
- - if (set_time == (RuleI(Zone, AutoShutdownDelay)))
- - {
- + // check if the zone is a non reserved instance
- + if (zone->GetInstanceID() > (RuleI(Zone, ReservedInstances))) {
- + bool is_perma = false;
- + // check if the instance has expired
- + if (database.GetTimeRemainingInstance(zone->GetInstanceID(), is_perma) == 0) {
- + //if it is expired, set the shutdown timer to 5 seconds (database default)
- + set_time = 5000;
- + autoshutdown_timer.Start(set_time, false);
- + }
- + } else if (set_time > autoshutdown_timer.GetRemainingTime()) {
- + if (set_time == (RuleI(Zone, AutoShutdownDelay))) {
- set_time = database.getZoneShutDownDelay(GetZoneID(), GetInstanceVersion());
- }
- autoshutdown_timer.Start(set_time, false);
- }
- +
- }
- bool Zone::Depop(bool StartSpawnTimer) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement