mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Quest: implement Quest Tracker
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
-- MySQL dump 10.13 Distrib 5.6.9-rc, for Win64 (x86_64)
|
||||
-- MySQL dump 10.13 Distrib 5.5.40, for debian-linux-gnu (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: characters
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.6.9-rc
|
||||
-- Server version 5.5.40-0ubuntu0.14.04.1
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
@@ -2438,6 +2438,34 @@ LOCK TABLES `pvpstats_players` WRITE;
|
||||
/*!40000 ALTER TABLE `pvpstats_players` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `quest_tracker`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `quest_tracker`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `quest_tracker` (
|
||||
`id` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`character_guid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`quest_accept_time` datetime NOT NULL,
|
||||
`quest_complete_time` datetime DEFAULT NULL,
|
||||
`quest_abandon_time` datetime DEFAULT NULL,
|
||||
`completed_by_gm` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`core_hash` varchar(120) NOT NULL DEFAULT '0',
|
||||
`core_revision` varchar(120) NOT NULL DEFAULT '0'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `quest_tracker`
|
||||
--
|
||||
|
||||
LOCK TABLES `quest_tracker` WRITE;
|
||||
/*!40000 ALTER TABLE `quest_tracker` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `quest_tracker` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `reserved_name`
|
||||
--
|
||||
@@ -2517,4 +2545,4 @@ UNLOCK TABLES;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2014-08-28 15:30:47
|
||||
-- Dump completed on 2014-10-18 18:02:06
|
||||
|
||||
12
sql/updates/characters/2014_10_18_00_characters.sql
Normal file
12
sql/updates/characters/2014_10_18_00_characters.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
DROP TABLE IF EXISTS `quest_tracker`;
|
||||
CREATE TABLE `quest_tracker` (
|
||||
`id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`character_guid` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`quest_accept_time` DATETIME NOT NULL,
|
||||
`quest_complete_time` DATETIME DEFAULT NULL,
|
||||
`quest_abandon_time` DATETIME DEFAULT NULL,
|
||||
`completed_by_gm` BOOL NOT NULL DEFAULT '0',
|
||||
`core_hash` VARCHAR(120) NOT NULL DEFAULT '0',
|
||||
`core_revision` VARCHAR(120) NOT NULL DEFAULT '0'
|
||||
)
|
||||
ENGINE=InnoDB;
|
||||
@@ -61,6 +61,7 @@
|
||||
#include "Pet.h"
|
||||
#include "QuestDef.h"
|
||||
#include "ReputationMgr.h"
|
||||
#include "revision.h"
|
||||
#include "SkillDiscovery.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "Spell.h"
|
||||
@@ -15235,6 +15236,19 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, quest_id);
|
||||
|
||||
SendQuestUpdate(quest_id);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
|
||||
{
|
||||
// prepare Quest Tracker datas
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_QUEST_TRACK);
|
||||
stmt->setUInt32(0, quest_id);
|
||||
stmt->setUInt32(1, GetGUIDLow());
|
||||
stmt->setString(2, _HASH);
|
||||
stmt->setString(3, _DATE);
|
||||
|
||||
// add to Quest Tracker
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::CompleteQuest(uint32 quest_id)
|
||||
@@ -15255,6 +15269,17 @@ void Player::CompleteQuest(uint32 quest_id)
|
||||
SendQuestComplete(quest_id);
|
||||
}
|
||||
}
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
|
||||
{
|
||||
// prepare Quest Tracker datas
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_COMPLETE_TIME);
|
||||
stmt->setUInt32(0, quest_id);
|
||||
stmt->setUInt32(1, GetGUIDLow());
|
||||
|
||||
// add to Quest Tracker
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::IncompleteQuest(uint32 quest_id)
|
||||
|
||||
@@ -420,6 +420,17 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData)
|
||||
_player->RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, questId);
|
||||
|
||||
TC_LOG_INFO("network", "Player %u abandoned quest %u", _player->GetGUIDLow(), questId);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
|
||||
{
|
||||
// prepare Quest Tracker datas
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_ABANDON_TIME);
|
||||
stmt->setUInt32(0, questId);
|
||||
stmt->setUInt32(1, _player->GetGUIDLow());
|
||||
|
||||
// add to Quest Tracker
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
}
|
||||
|
||||
_player->SetQuestSlot(slot, 0);
|
||||
|
||||
@@ -963,6 +963,8 @@ void World::LoadConfigSettings(bool reload)
|
||||
|
||||
m_int_configs[CONFIG_WORLD_BOSS_LEVEL_DIFF] = sConfigMgr->GetIntDefault("WorldBossLevelDiff", 3);
|
||||
|
||||
m_bool_configs[CONFIG_QUEST_ENABLE_QUEST_TRACKER] = sConfigMgr->GetBoolDefault("Quests.EnableQuestTracker", false);
|
||||
|
||||
// note: disable value (-1) will assigned as 0xFFFFFFF, to prevent overflow at calculations limit it to max possible player level MAX_LEVEL(100)
|
||||
m_int_configs[CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF] = sConfigMgr->GetIntDefault("Quests.LowLevelHideDiff", 4);
|
||||
if (m_int_configs[CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF] > MAX_LEVEL)
|
||||
|
||||
@@ -149,6 +149,7 @@ enum WorldBoolConfigs
|
||||
CONFIG_PDUMP_NO_OVERWRITE,
|
||||
CONFIG_QUEST_IGNORE_AUTO_ACCEPT,
|
||||
CONFIG_QUEST_IGNORE_AUTO_COMPLETE,
|
||||
CONFIG_QUEST_ENABLE_QUEST_TRACKER,
|
||||
CONFIG_WARDEN_ENABLED,
|
||||
CONFIG_ENABLE_MMAPS,
|
||||
CONFIG_WINTERGRASP_ENABLE,
|
||||
|
||||
@@ -238,6 +238,17 @@ public:
|
||||
if (ReqOrRewMoney < 0)
|
||||
player->ModifyMoney(-ReqOrRewMoney);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
|
||||
{
|
||||
// prepare Quest Tracker datas
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_GM_COMPLETE);
|
||||
stmt->setUInt32(0, quest->GetQuestId());
|
||||
stmt->setUInt32(1, player->GetGUIDLow());
|
||||
|
||||
// add to Quest Tracker
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
player->CompleteQuest(entry);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -603,4 +603,9 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_INS_PVPSTATS_BATTLEGROUND, "INSERT INTO pvpstats_battlegrounds (id, winner_faction, bracket_id, type, date) VALUES (?, ?, ?, ?, NOW())", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_PVPSTATS_PLAYER, "INSERT INTO pvpstats_players (battleground_id, character_guid, score_killing_blows, score_deaths, score_honorable_kills, score_bonus_honor, score_damage_done, score_healing_done, attr_1, attr_2, attr_3, attr_4, attr_5) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
|
||||
// QuestTracker
|
||||
PrepareStatement(CHAR_INS_QUEST_TRACK, "INSERT INTO quest_tracker (id, character_guid, quest_accept_time, core_hash, core_revision) VALUES (?, ?, NOW(), ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_QUEST_TRACK_GM_COMPLETE, "UPDATE quest_tracker SET completed_by_gm = 1 WHERE id = ? AND character_guid = ? ORDER BY quest_accept_time DESC LIMIT 1", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_QUEST_TRACK_COMPLETE_TIME, "UPDATE quest_tracker SET quest_complete_time = NOW() WHERE id = ? AND character_guid = ? ORDER BY quest_accept_time DESC LIMIT 1", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_QUEST_TRACK_ABANDON_TIME, "UPDATE quest_tracker SET quest_abandon_time = NOW() WHERE id = ? AND character_guid = ? ORDER BY quest_accept_time DESC LIMIT 1", CONNECTION_ASYNC);
|
||||
}
|
||||
|
||||
@@ -536,6 +536,11 @@ enum CharacterDatabaseStatements
|
||||
CHAR_INS_PVPSTATS_BATTLEGROUND,
|
||||
CHAR_INS_PVPSTATS_PLAYER,
|
||||
|
||||
CHAR_INS_QUEST_TRACK,
|
||||
CHAR_UPD_QUEST_TRACK_GM_COMPLETE,
|
||||
CHAR_UPD_QUEST_TRACK_COMPLETE_TIME,
|
||||
CHAR_UPD_QUEST_TRACK_ABANDON_TIME,
|
||||
|
||||
MAX_CHARACTERDATABASE_STATEMENTS
|
||||
};
|
||||
|
||||
|
||||
@@ -854,6 +854,14 @@ Instance.UnloadDelay = 1800000
|
||||
|
||||
InstancesResetAnnounce = false
|
||||
|
||||
#
|
||||
# Quests.EnableQuestTracker
|
||||
# Description: Store datas in the database about quest completion and abandonment to help finding out bugged quests.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
Quests.EnableQuestTracker = 0
|
||||
|
||||
#
|
||||
# Quests.LowLevelHideDiff
|
||||
# Description: Level difference between player and quest level at which quests are
|
||||
|
||||
Reference in New Issue
Block a user