aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/characters.sql1
-rw-r--r--sql/updates/7915_characters_worldstates.sql2
-rw-r--r--src/game/World.cpp12
-rw-r--r--src/game/World.h5
-rw-r--r--src/scripts/northrend/violet_hold/violet_hold.h2
5 files changed, 13 insertions, 9 deletions
diff --git a/sql/characters.sql b/sql/characters.sql
index c6dafbe533d..d4e4f132617 100644
--- a/sql/characters.sql
+++ b/sql/characters.sql
@@ -1936,7 +1936,6 @@ DROP TABLE IF EXISTS `worldstates`;
CREATE TABLE `worldstates` (
`entry` mediumint(11) UNSIGNED NOT NULL DEFAULT '0',
`value` bigint(40) UNSIGNED NOT NULL DEFAULT '0',
- `NextWeeklyQuestResetTime` bigint(40) unsigned NOT NULL default '0',
`comment` text NOT NULL,
PRIMARY KEY (`entry`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Variable Saves';
diff --git a/sql/updates/7915_characters_worldstates.sql b/sql/updates/7915_characters_worldstates.sql
new file mode 100644
index 00000000000..cad658e6606
--- /dev/null
+++ b/sql/updates/7915_characters_worldstates.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `worldstates` DROP COLOMUN `NextWeeklyQuestResetTime`;
+INSERT INTO `worldstates` (`entry`,`value`, `comment`) VALUES (20002, 0, 'NextWeeklyQuestResetTime');
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 7419e65772d..76aa6a94b4b 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -2497,17 +2497,15 @@ void World::_UpdateRealmCharCount(QueryResult_AutoPtr resultCharCount, uint32 ac
}
void World::InitWeeklyQuestResetTime()
-{
- QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT NextWeeklyQuestResetTime FROM worldstates");
- if (!result)
+{
+ time_t time = uint64(sWorld.getWorldState(WS_WEEKLY_QUEST_RESET_TIME));
+ if (!time)
{
m_NextWeeklyQuestReset = time_t(m_gameTime + WEEK);
- CharacterDatabase.PExecute("INSERT INTO worldstates (NextWeeklyQuestResetTime) VALUES ('"UI64FMTD"')", uint64(m_NextWeeklyQuestReset));
+ sWorld.setWorldState(WS_WEEKLY_QUEST_RESET_TIME, uint64(m_NextWeeklyQuestReset));
}
else
{
- m_NextWeeklyQuestReset = time_t((*result)[0].GetUInt64());
-
// move to just before if need
time_t cur = time(NULL);
if (m_NextWeeklyQuestReset < cur)
@@ -2580,7 +2578,7 @@ void World::ResetWeeklyQuests()
itr->second->GetPlayer()->ResetWeeklyQuestStatus();
m_NextWeeklyQuestReset = time_t(m_NextWeeklyQuestReset + WEEK);
- CharacterDatabase.PExecute("UPDATE worldstates SET NextWeeklyQuestResetTime = '"UI64FMTD"'", uint64(m_NextWeeklyQuestReset));
+ sWorld.setWorldState(WS_WEEKLY_QUEST_RESET_TIME, uint64(m_NextWeeklyQuestReset));
}
void World::SetPlayerLimit(int32 limit, bool needUpdate)
diff --git a/src/game/World.h b/src/game/World.h
index 7477c317617..dee7eaa1c03 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -413,6 +413,11 @@ enum RealmZone
REALM_ZONE_CN5_8 = 37 // basic-Latin at create, any at login
};
+enum WorldStates
+{
+ WS_WEEKLY_QUEST_RESET_TIME = 20002 // Next weekly reset time
+};
+
// DB scripting commands
#define SCRIPT_COMMAND_TALK 0 // source = unit, target=any, datalong (0=say, 1=whisper, 2=yell, 3=emote text, 4=boss emote text)
#define SCRIPT_COMMAND_EMOTE 1 // source = unit, datalong = anim_id
diff --git a/src/scripts/northrend/violet_hold/violet_hold.h b/src/scripts/northrend/violet_hold/violet_hold.h
index e9f97b1a973..4476d5e823a 100644
--- a/src/scripts/northrend/violet_hold/violet_hold.h
+++ b/src/scripts/northrend/violet_hold/violet_hold.h
@@ -61,7 +61,7 @@ enum Bosses
BOSS_CYANIGOSA
};
-enum WorldStates
+enum VHWorldStates
{
WORLD_STATE_VH = 3816,
WORLD_STATE_VH_PRISON_STATE = 3815,