Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Niam5 committed Oct 11, 2023
2 parents b14395f + bfb045e commit c1ab171
Show file tree
Hide file tree
Showing 154 changed files with 499 additions and 550 deletions.
3 changes: 0 additions & 3 deletions cmake/macros/FindMySQL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ if(WIN32)
"${PROGRAM_FILES_64}/MySQL/MySQL Server 8.1/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 8.0/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.6/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.5/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.1/lib"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 8.1/lib/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 8.0/lib/opt"
"${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/lib/opt"
Expand Down
1 change: 1 addition & 0 deletions sql/updates/world/4.3.4/2023_10_01_01_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_algalon_supermassive_fail';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--
DELETE FROM `creature` WHERE `id` IN (36506) AND `guid`=85216;
DELETE FROM `creature_addon` WHERE `guid`=85216;
2 changes: 1 addition & 1 deletion src/server/bnetserver/bnetserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ SourceDirectory = ""
# MySQLExecutable
# Description: The path to your mysql cli binary.
# If the path is left empty, built-in path from cmake is used.
# Example: "C:/Program Files/MySQL/MySQL Server 5.6/bin/mysql.exe"
# Example: "C:/Program Files/MySQL/MySQL Server 5.7/bin/mysql.exe"
# "mysql.exe"
# "/usr/bin/mysql"
# Default: ""
Expand Down
1 change: 0 additions & 1 deletion src/server/game/AI/CreatureAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "SpellHistory.h"
#include "TemporarySummon.h"
#include "Vehicle.h"
#include "World.h"

//Disable CreatureAI when charmed
void CreatureAI::OnCharmed(bool isNew)
Expand Down
1 change: 0 additions & 1 deletion src/server/game/AI/CreatureAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#define TRINITY_CREATUREAI_H

#include "UnitAI.h"
#include "Common.h"
#include "ObjectDefines.h"
#include "Optional.h"
#include "QuestDef.h"
Expand Down
1 change: 0 additions & 1 deletion src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "Log.h"
#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "Spell.h"
#include "SpellMgr.h"
#include "TemporarySummon.h"

Expand Down
364 changes: 187 additions & 177 deletions src/server/game/Achievements/AchievementMgr.cpp

Large diffs are not rendered by default.

29 changes: 10 additions & 19 deletions src/server/game/Achievements/AchievementMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "DatabaseEnvFwd.h"
#include "DBCEnums.h"
#include "DBCStores.h"
#include "Duration.h"
#include "ObjectGuid.h"
#include <string>
#include <unordered_map>
Expand All @@ -36,7 +37,6 @@ typedef std::vector<AchievementEntry const*> AchievementEntryList;

typedef std::unordered_map<uint32, AchievementCriteriaEntryList> AchievementCriteriaListByAchievement;
typedef std::unordered_map<uint32, AchievementCriteriaEntryList> AchievementCriteriaListByMiscValue;
typedef std::unordered_map<uint32, AchievementCriteriaEntryList> AchievementCriteriaListByCondition;
typedef std::unordered_map<uint32, AchievementEntryList> AchievementListByReferencedId;

struct CriteriaProgress
Expand Down Expand Up @@ -266,7 +266,6 @@ class TC_GAME_API AchievementMgr
static void DeleteFromDB(ObjectGuid lowguid);
void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult);
void SaveToDB(CharacterDatabaseTransaction& trans);
void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint64 value, bool evenIfCriteriaComplete);
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint64 miscValue1 = 0, uint64 miscValue2 = 0, uint64 miscValue3 = 0, WorldObject const* ref = nullptr, Player* referencePlayer = nullptr, GameObject* go = nullptr);
void CompletedAchievement(AchievementEntry const* entry, Player* referencePlayer);
void CheckAllAchievementCriteria(Player* referencePlayer);
Expand All @@ -277,9 +276,9 @@ class TC_GAME_API AchievementMgr
CompletedAchievementData* GetCompletedDataForAchievement(uint32 achievementId);
T* GetOwner() const { return _owner; }

void UpdateTimedAchievements(uint32 timeDiff);
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0);
void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); // used for quest and scripted timed achievements
void UpdateTimedAchievementCriteria(Milliseconds timeDiff);
void StartAchievementCriteria(AchievementCriteriaStartEvent startEvent, uint32 asset, Milliseconds timeLost = Milliseconds::zero());
void FailAchievementCriteria(AchievementCriteriaFailEvent failEvent, uint32 asset);

uint32 GetAchievementPoints() const { return _achievementPoints; }
private:
Expand All @@ -301,9 +300,9 @@ class TC_GAME_API AchievementMgr
T* _owner;
CriteriaProgressMap m_criteriaProgress;
CompletedAchievementMap m_completedAchievements;
typedef std::map<uint32, uint32> TimedAchievementMap;
TimedAchievementMap m_timedAchievements; // Criteria id/time left in MS
uint32 _achievementPoints;

std::unordered_map<uint32 /*criteriaID*/, Milliseconds /*time left*/> _startedCriteria;
};

class TC_GAME_API AchievementGlobalMgr
Expand All @@ -319,16 +318,9 @@ class TC_GAME_API AchievementGlobalMgr

AchievementCriteriaEntryList const& GetAchievementCriteriaByType(AchievementCriteriaTypes type, uint32 miscValue, bool guild = false) const;

AchievementCriteriaEntryList const& GetTimedAchievementCriteriaByType(AchievementCriteriaTimedTypes type) const
{
return m_AchievementCriteriasByTimedType[type];
}
AchievementCriteriaEntryList const* GetAchievementCriteriaByStartEvent(AchievementCriteriaStartEvent startEvent, int32 asset) const;

AchievementCriteriaEntryList const* GetAchievementCriteriaByCondition(AchievementCriteriaCondition condition, uint32 val)
{
AchievementCriteriaListByCondition::const_iterator itr = m_AchievementCriteriasByCondition[condition].find(val);
return itr != m_AchievementCriteriasByCondition[condition].end() ? &itr->second : nullptr;
}
AchievementCriteriaEntryList const* GetAchievementCriteriaByFailEvent(AchievementCriteriaFailEvent startEvent, int32 asset) const;

AchievementCriteriaEntryList const* GetAchievementCriteriaByAchievement(uint32 id) const
{
Expand Down Expand Up @@ -399,9 +391,8 @@ class TC_GAME_API AchievementGlobalMgr
AchievementCriteriaListByMiscValue m_AchievementCriteriasByMiscValue[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];
AchievementCriteriaListByMiscValue m_GuildAchievementCriteriasByMiscValue[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];

AchievementCriteriaEntryList m_AchievementCriteriasByTimedType[ACHIEVEMENT_TIMED_TYPE_MAX];

AchievementCriteriaListByCondition m_AchievementCriteriasByCondition[ACHIEVEMENT_CRITERIA_CONDITION_MAX];
std::unordered_map<int32, AchievementCriteriaEntryList> _criteriasByStartEvent[size_t(AchievementCriteriaStartEvent::Count)];
std::unordered_map<int32, AchievementCriteriaEntryList> _criteriasByFailEvent[size_t(AchievementCriteriaFailEvent::Count)];

// store achievement criterias by achievement to speed up lookup
AchievementCriteriaListByAchievement m_AchievementCriteriaListByAchievement;
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/Battlegrounds/Arena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ void Arena::EndBattleground(uint32 winner)
{
// update achievement BEFORE personal rating update
uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());
player->StartAchievementCriteria(AchievementCriteriaStartEvent::WinRankedArenaMatchWithTeamSize, 0);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId());
player->ModifyCurrency(CURRENCY_TYPE_CONQUEST_META_ARENA, sWorld->getIntConfig(CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD));
Expand All @@ -335,7 +336,7 @@ void Arena::EndBattleground(uint32 winner)
loserArenaTeam->MemberLost(player, winnerMatchmakerRating, loserMatchmakerChange);

// Arena lost => reset the win_rated_arena having the "no_lose" condition
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE, 0);
player->FailAchievementCriteria(AchievementCriteriaFailEvent::LoseRankedArenaMatchWithTeamSize, 0);
}
}

Expand Down
9 changes: 5 additions & 4 deletions src/server/game/Battlegrounds/Battleground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,10 @@ inline void Battleground::_ProcessJoin(uint32 diff)
SetStatus(STATUS_IN_PROGRESS);
SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FOURTH]);

for (auto const& [guid, _] : GetPlayers())
if (Player* player = ObjectAccessor::GetPlayer(GetBgMap(), guid))
player->StartAchievementCriteria(AchievementCriteriaStartEvent::StartBattleground, GetBgMap()->GetId());

// Remove preparation
if (isArena())
{
Expand Down Expand Up @@ -1036,7 +1040,7 @@ void Battleground::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
player->SetBGTeam(0);

// remove all criterias on bg leave
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
player->FailAchievementCriteria(AchievementCriteriaFailEvent::LeaveBattleground, 0);

player->RemoveBattlegroundQueueJoinTime(bgTypeId);

Expand Down Expand Up @@ -1160,9 +1164,6 @@ void Battleground::AddPlayer(Player* player)
}
}

// reset all map criterias on map enter
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);

// setup BG group membership
PlayerAddedToBGCheckIfBGIsRunning(player);
AddOrSetPlayerToCorrectBgGroup(player, team);
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ void BattlegroundTP::EventPlayerClickedOnFlag(Player* player, GameObject* target
UpdateFlagState(HORDE, BG_TP_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_TP_FLAG_UNK_ALLIANCE, 1);
player->CastSpell(player, BG_TP_SPELL_ALLIANCE_FLAG, true);
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_TP_SPELL_ALLIANCE_FLAG_PICKED);
player->StartAchievementCriteria(AchievementCriteriaStartEvent::BeSpellTarget, BG_TP_SPELL_ALLIANCE_FLAG_PICKED);
if (_flagState[1] == BG_TP_FLAG_STATE_ON_PLAYER)
_bothFlagsKept = true;
}
Expand All @@ -585,7 +585,7 @@ void BattlegroundTP::EventPlayerClickedOnFlag(Player* player, GameObject* target
UpdateFlagState(ALLIANCE, BG_TP_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_TP_FLAG_UNK_HORDE, 1);
player->CastSpell(player, BG_TP_SPELL_HORDE_FLAG, true);
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_TP_SPELL_HORDE_FLAG_PICKED);
player->StartAchievementCriteria(AchievementCriteriaStartEvent::BeSpellTarget, BG_TP_SPELL_HORDE_FLAG_PICKED);
if (_flagState[0] == BG_TP_FLAG_STATE_ON_PLAYER)
_bothFlagsKept = true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target
//update world state to show correct flag carrier
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG, true);
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
player->StartAchievementCriteria(AchievementCriteriaStartEvent::BeSpellTarget, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
if (_flagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
_bothFlagsKept = true;
}
Expand All @@ -481,7 +481,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target
//update world state to show correct flag carrier
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG, true);
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED);
player->StartAchievementCriteria(AchievementCriteriaStartEvent::BeSpellTarget, BG_WS_SPELL_WARSONG_FLAG_PICKED);
if (_flagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
_bothFlagsKept = true;
}
Expand Down
Loading

0 comments on commit c1ab171

Please sign in to comment.