Jump to content

[BUG]instance Reset time.


Guest ascent

Recommended Posts

code fix

i'm not test

diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp
index 81aca01..f408079 100644
--- a/src/game/InstanceSaveMgr.cpp
+++ b/src/game/InstanceSaveMgr.cpp
@@ -475,7 +475,9 @@ void InstanceSaveManager::LoadResetTimes()
            continue;

        // the reset_delay must be at least one day
-        uint32 period =  (mapDiff->resetTime / DAY * sWorld.getRate(RATE_INSTANCE_RESET_TIME)) * DAY;
+        uint32 period = ((mapDiff->resetTime * sWorld.getRate(RATE_INSTANCE_RESET_TIME))/DAY) * DAY;
+        if (period < DAY)
+            period = DAY;

        time_t t = GetResetTimeFor(mapid,difficulty);
        if(!t)
@@ -503,6 +505,8 @@ void InstanceSaveManager::LoadResetTimes()
            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)
        {
@@ -636,8 +640,14 @@ 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;
+        uint32 period = ((mapDiff->resetTime * sWorld.getRate(RATE_INSTANCE_RESET_TIME))/DAY) * DAY;
+        if (period < DAY)
+            period = DAY;
        uint64 next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff;
+
+        SetResetTimeFor(mapid, difficulty, next_reset);
+        ScheduleReset(true, time_t(next_reset-3600), InstResetEvent(1, mapid, difficulty, -1));
+
        // update it in the DB
        CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d' AND difficulty = '%d'", next_reset, mapid, difficulty);
    }

Link to comment
Share on other sites

code fix

i'm not test

diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp
index 81aca01..f408079 100644
--- a/src/game/InstanceSaveMgr.cpp
+++ b/src/game/InstanceSaveMgr.cpp
@@ -475,7 +475,9 @@ void InstanceSaveManager::LoadResetTimes()
            continue;

        // the reset_delay must be at least one day
-        uint32 period =  (mapDiff->resetTime / DAY * sWorld.getRate(RATE_INSTANCE_RESET_TIME)) * DAY;
+        uint32 period = ((mapDiff->resetTime * sWorld.getRate(RATE_INSTANCE_RESET_TIME))/DAY) * DAY;
+        if (period < DAY)
+            period = DAY;

        time_t t = GetResetTimeFor(mapid,difficulty);
        if(!t)
@@ -503,6 +505,8 @@ void InstanceSaveManager::LoadResetTimes()
            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)
        {
@@ -636,8 +640,14 @@ 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;
+        uint32 period = ((mapDiff->resetTime * sWorld.getRate(RATE_INSTANCE_RESET_TIME))/DAY) * DAY;
+        if (period < DAY)
+            period = DAY;
        uint64 next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff;
+
+        SetResetTimeFor(mapid, difficulty, next_reset);
+        ScheduleReset(true, time_t(next_reset-3600), InstResetEvent(1, mapid, difficulty, -1));
+
        // update it in the DB
        CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d' AND difficulty = '%d'", next_reset, mapid, difficulty);
    }

this fix old fix, but this bug is kill named(boss) bind bug.

Link to comment
Share on other sites

You can try this (I don't test it!!!):

diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp
index 81aca01..0b8eacd 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

Link to comment
Share on other sites

You can try this (I don't test it!!!):

diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp
index 81aca01..0b8eacd 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

4> .. \\ .. \\ src \\ game \\ InstanceSaveMgr.cpp (644): error C2039: 'getRate': 'World' is not a member.

4> c: \\ users \\ administrator \\ documents \\ mangos \\ src \\ game \\ World.h (393): 'World', see the declaration.

4> .. \\ .. \\ src \\ game \\ InstanceSaveMgr.cpp (644): error C2065: 'RATE_INSTANCE_RESET_TIME': undeclared identifier.

Link to comment
Share on other sites

diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp
index 289ea07..e67e0a8 100644
--- a/src/game/InstanceSaveMgr.cpp
+++ b/src/game/InstanceSaveMgr.cpp
@@ -501,9 +501,10 @@ 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)
@@ -610,6 +611,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
        return;

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

    if (!warn)
    {
@@ -638,11 +640,16 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b

        // calculate the next reset time
        uint32 diff = sWorld.getConfig(CONFIG_UINT32_INSTANCE_RESET_TIME_HOUR) * HOUR;
-        uint32 period = mapDiff->resetTime * DAY;
+        uint32 period =  uint32(mapDiff->resetTime / DAY * sWorld.getConfig(CONFIG_FLOAT_RATE_INSTANCE_RESET_TIME)) * DAY;
+        if (period < DAY)
+        period = DAY;
        time_t next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff;
+        SetResetTimeFor(mapid, difficulty, next_reset);
+        ScheduleReset(true, time_t(next_reset-3600), InstResetEvent(1, mapid, difficulty, -1));
        // update it in the DB
        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
    Map const *map = sMapMgr.CreateBaseMap(mapid);          // _not_ include difficulty

Compiles.This fix works only Win, on Unix bug remains :(

Link to comment
Share on other sites

×
×
  • 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