Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mangoszero/server
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1arm committed May 16, 2023
2 parents f695452 + 7a4f9d9 commit a6479fe
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmake/MangosParams.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set(MANGOS_EXP "CLASSIC")
set(MANGOS_PKG "Mangos Zero")
set(MANGOS_WORLD_VER 2022031600)
set(MANGOS_WORLD_VER 2023031100)
set(MANGOS_REALM_VER 2021010100)
set(MANGOS_AHBOT_VER 2021010100)
14 changes: 14 additions & 0 deletions src/game/ChatCommands/QuestCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Chat.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "World.h"
#include "SQLStorages.h"

bool ChatHandler::HandleQuestAddCommand(char* args)
Expand Down Expand Up @@ -232,6 +233,19 @@ bool ChatHandler::HandleQuestCompleteCommand(char* args)
player->ModifyMoney(-ReqOrRewMoney);
}

if (sWorld.getConfig(CONFIG_BOOL_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
{
DEBUG_LOG("QUEST TRACKER: Quest Completed by GM.");
static SqlStatementID CHAR_UPD_QUEST_TRACK_GM_COMPLETE;
// prepare Quest Tracker datas
SqlStatement stmt = CharacterDatabase.CreateStatement(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");
stmt.addUInt32(pQuest->GetQuestId());
stmt.addUInt32(player->GetGUIDLow());

// add to Quest Tracker
stmt.Execute();
}

player->CompleteQuest(entry, QUEST_STATUS_FORCE_COMPLETE);
return true;
}
9 changes: 2 additions & 7 deletions src/game/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1580,18 +1580,13 @@ void WorldObject::SetMap(Map* map)
m_InstanceId = map->GetInstanceId();

#ifdef ENABLE_ELUNA
delete elunaEvents;
// On multithread replace this with a pointer to map's Eluna pointer stored in a map
elunaEvents = new ElunaEventProcessor(&Eluna::GEluna, this);
if (!elunaEvents)
elunaEvents = new ElunaEventProcessor(&Eluna::GEluna, this);
#endif
}

void WorldObject::ResetMap()
{
#ifdef ENABLE_ELUNA
delete elunaEvents;
elunaEvents = NULL;
#endif
}

void WorldObject::AddObjectToRemoveList()
Expand Down
30 changes: 30 additions & 0 deletions src/game/Object/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include "BattleGround/BattleGroundAV.h"
#include "OutdoorPvP/OutdoorPvP.h"
#include "Chat.h"
#include "revision_data.h"
#include "Database/DatabaseImpl.h"
#include "Spell.h"
#include "ScriptMgr.h"
Expand Down Expand Up @@ -14690,6 +14691,22 @@ void Player::AddQuest(Quest const* pQuest, Object* questGiver)
}

UpdateForQuestWorldObjects();

if (sWorld.getConfig(CONFIG_BOOL_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
{
DEBUG_LOG("QUEST TRACKER: Quest Added.");

static SqlStatementID CHAR_INS_QUEST_TRACK;
// prepare Quest Tracker datas
SqlStatement stmt = CharacterDatabase.CreateStatement(CHAR_INS_QUEST_TRACK, "INSERT INTO `quest_tracker` (`id`, `character_guid`, `quest_accept_time`, `core_hash`, `core_revision`) VALUES (?, ?, NOW(), ?, ?)");
stmt.addUInt32(quest_id);
stmt.addUInt32(GetGUIDLow());
stmt.addString(REVISION_HASH);
stmt.addString(REVISION_DATE);

// add to Quest Tracker
stmt.Execute();
}
}

void Player::CompleteQuest(uint32 quest_id, QuestStatus status)
Expand All @@ -14712,6 +14729,19 @@ void Player::CompleteQuest(uint32 quest_id, QuestStatus status)
}
}
}

if (sWorld.getConfig(CONFIG_BOOL_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
{
DEBUG_LOG("QUEST TRACKER: Quest Completed.");
static SqlStatementID CHAR_UPD_QUEST_TRACK_COMPLETE_TIME;
// prepare Quest Tracker datas
SqlStatement stmt = CharacterDatabase.CreateStatement(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");
stmt.addUInt32(quest_id);
stmt.addUInt32(GetGUIDLow());

// add to Quest Tracker
stmt.Execute();
}
}

void Player::IncompleteQuest(uint32 quest_id)
Expand Down
13 changes: 13 additions & 0 deletions src/game/WorldHandlers/QuestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,19 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data)

_player->SetQuestStatus(quest, QUEST_STATUS_NONE);

if (sWorld.getConfig(CONFIG_BOOL_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
{
DEBUG_LOG("QUEST TRACKER: Quest Abandoned.");
static SqlStatementID CHAR_UPD_QUEST_TRACK_ABANDON_TIME;
// prepare Quest Tracker datas
SqlStatement stmt = CharacterDatabase.CreateStatement(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");
stmt.addUInt32(quest);
stmt.addUInt32(_player->GetGUIDLow());

// add to Quest Tracker
stmt.Execute();
}

// Used by Eluna
#ifdef ENABLE_ELUNA
sEluna->OnQuestAbandon(_player, quest);
Expand Down
2 changes: 2 additions & 0 deletions src/game/WorldHandlers/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,8 @@ void World::LoadConfigSettings(bool reload)

setConfig(CONFIG_BOOL_PET_UNSUMMON_AT_MOUNT, "PetUnsummonAtMount", false);

setConfig(CONFIG_BOOL_ENABLE_QUEST_TRACKER, "QuestTracker.Enable", 0);

#ifdef ENABLE_PLAYERBOTS
setConfig(CONFIG_BOOL_PLAYERBOT_DISABLE, "PlayerbotAI.DisableBots", true);
setConfig(CONFIG_BOOL_PLAYERBOT_DEBUGWHISPER, "PlayerbotAI.DebugWhisper", false);
Expand Down
1 change: 1 addition & 0 deletions src/game/WorldHandlers/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ enum eConfigBoolValues
CONFIG_BOOL_ELUNA_ENABLED,
CONFIG_BOOL_PLAYER_COMMANDS,
CONFIG_BOOL_AUTOPOOLING_MINING_ENABLE,
CONFIG_BOOL_ENABLE_QUEST_TRACKER,
#ifdef ENABLE_PLAYERBOTS
CONFIG_BOOL_PLAYERBOT_DISABLE,
CONFIG_BOOL_PLAYERBOT_DEBUGWHISPER,
Expand Down
11 changes: 11 additions & 0 deletions src/mangosd/mangosd.conf.dist.in
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,17 @@ CharDelete.Method = 0
CharDelete.MinLevel = 0
CharDelete.KeepDays = 30

###################################################################################################
# QUEST TRACKER
# QuestTracker.Enable
# Description: Store data in the database about quest completion and abandonment to help find bugged quests.
# Default: 0 - (Disabled)
# 1 - (Enabled)
#
###################################################################################################

QuestTracker.Enable= 0

###################################################################################################
# WARDEN SETTINGS
#
Expand Down
4 changes: 2 additions & 2 deletions src/shared/revision_data.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
#define REALMD_DB_UPDATE_DESCRIPT "Release 22"

#define CHAR_DB_VERSION_NR "22"
#define CHAR_DB_STRUCTURE_NR "3"
#define CHAR_DB_STRUCTURE_NR "4"
#define CHAR_DB_CONTENT_NR "1"
#define CHAR_DB_UPDATE_DESCRIPT "remove_item_text"
#define CHAR_DB_UPDATE_DESCRIPT "Add_Quest_Tracker_Table"

#define WORLD_DB_VERSION_NR "22"
#define WORLD_DB_STRUCTURE_NR "4"
Expand Down

0 comments on commit a6479fe

Please sign in to comment.