Jump to content

Instance Reset Time


Recommended Posts

  • 39 years later...

Anybody can help on setting instance reset timer for heroic raids or normal raids ?

For example , 5-6 hours time ?

Tried searching in the forum, some doesn't work & i cant find any others that are related. Even tried setting conf file, still doesn't work . Thank you very much.

Link to comment
Share on other sites

Anybody can help on setting instance reset timer for heroic raids or normal raids ?

For example , 5-6 hours time ?

Tried searching in the forum, some doesn't work & i cant find any others that are related. Even tried setting conf file, still doesn't work . Thank you very much.

InstanceSaveMgr.cpp

InstanceSave* InstanceSaveManager::AddInstanceSave function

Link to comment
Share on other sites

so which shud i adjust bro ?

   if(!resetTime)
   {
       // initialize reset time
       // for normal instances if no creatures are killed the instance will reset in two hours
       if(entry->map_type == MAP_RAID || difficulty > DUNGEON_DIFFICULTY_NORMAL)
[b][color=Red]-            resetTime = GetResetTimeFor(mapId,difficulty);[/color]
[color=Red]+           [/color][color=Lime]resetTime = time(NULL) + 5 * HOUR;[/color][/b]

       else
       {
           resetTime = time(NULL) + 2 * HOUR;
           // normally this will be removed soon after in InstanceMap::Add, prevent error
           ScheduleReset(true, resetTime, InstResetEvent(0, mapId, difficulty, instanceId));
       }
   }

Link to comment
Share on other sites

Try this.

Author: Wowka32

From 4acaf39c91ebd0443a8dce97e330a25b0ce14f3f Mon Sep 17 00:00:00 2001
From: Wowka321 <[email protected]>
Date: Sun, 27 Dec 2009 00:10:27 +0200
Subject: [PATCH] Attemt to fix instance reset

---
src/game/InstanceSaveMgr.cpp |   15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp
index 54f71b2..a18aeda 100644
--- a/src/game/InstanceSaveMgr.cpp
+++ b/src/game/InstanceSaveMgr.cpp
@@ -499,10 +499,12 @@ void InstanceSaveManager::LoadResetTimes()
        // schedule the global reset/warning
        uint8 type = 1;
        static int tim[4] = {3600, 900, 300, 60};
-        for(; type < 4; type++)
+        for(type; type < 4; type++)
            if(t - tim[type-1] > now)
                break;

+        ScheduleReset(true, t - tim[type-1], InstResetEvent(type, mapid, difficulty, -1));
+
        for(ResetTimeMapDiffInstances::const_iterator in_itr = mapDiffResetInstances.lower_bound(map_diff_pair);
            in_itr != mapDiffResetInstances.upper_bound(map_diff_pair); ++in_itr)
        {
@@ -607,7 +609,8 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
    if (!mapEntry->Instanceable())
        return;

-    uint64 now = (uint64)time(NULL);
+    time_t now = time(NULL);
+    time_t today = (now / DAY) * DAY;

    if (!warn)
    {
@@ -636,10 +639,12 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b

        // calculate the next reset time
        uint32 diff = sWorld.getConfig(CONFIG_INSTANCE_RESET_TIME_HOUR) * HOUR;
-        uint32 period = mapDiff->resetTime * DAY;
-        uint64 next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff;
+        uint32 period = (mapDiff->resetTime / DAY * sWorld.getRate(RATE_INSTANCE_RESET_TIME)) * DAY;
+        time_t next_reset = today + period + diff;
        // update it in the DB
-        CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d' AND difficulty = '%d'", next_reset, mapid, difficulty);
+        CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d' AND difficulty = '%d'", (uint64)next_reset, mapid, difficulty);
+        SetResetTimeFor(mapid,difficulty,(uint64)next_reset);
+        ScheduleReset(true, next_reset-3600, InstResetEvent(1, mapid, difficulty, -1));
    }

    // note: this isn't fast but it's meant to be executed very rarely
-- 
1.6.0.2.1172.ga5ed0

Link to comment
Share on other sites

This patch contains much trash/nonsense. for example this:

-        for(; type < 4; type++)
+        for(type; type < 4; type++)

this doesn't change anything...

maybe, and only maybe, this might be the solution:

+        ScheduleReset(true, t - tim[type-1], InstResetEvent(type, mapid, difficulty, -1));

-- DasBlub

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use