Merge branch 'master' into Playerbot

# Conflicts:
#	src/server/game/World/World.h
This commit is contained in:
郑佩茹
2023-02-09 12:40:25 -07:00
1253 changed files with 114535 additions and 40950 deletions

View File

@@ -269,7 +269,7 @@ namespace lfg
// Recalculate locked dungeons
for (LfgPlayerDataContainer::const_iterator it = PlayersStore.begin(); it != PlayersStore.end(); ++it)
if (Player* player = ObjectAccessor::FindConnectedPlayer(it->first))
InitializeLockedDungeons(player);
InitializeLockedDungeons(player, nullptr);
}
}
@@ -388,11 +388,11 @@ namespace lfg
@param[in] player Player we need to initialize the lock status map
*/
void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */)
void LFGMgr::InitializeLockedDungeons(Player* player, Group const* group)
{
ObjectGuid guid = player->GetGUID();
if (!level)
level = player->getLevel();
uint8 level = player->GetLevel();
uint8 expansion = player->GetSession()->Expansion();
LfgDungeonSet const& dungeons = GetDungeonsByRandom(0);
LfgLockMap lock;
@@ -429,12 +429,15 @@ namespace lfg
// Check required items
for (const ProgressionRequirement* itemRequirement : ar->items)
{
if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == player->GetTeamId(true))
if (!itemRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
{
if (!player->HasItemCount(itemRequirement->id, 1))
if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == player->GetTeamId(true))
{
lockData = LFG_LOCKSTATUS_MISSING_ITEM;
break;
if (!player->HasItemCount(itemRequirement->id, 1))
{
lockData = LFG_LOCKSTATUS_MISSING_ITEM;
break;
}
}
}
}
@@ -442,12 +445,15 @@ namespace lfg
//Check for quests
for (const ProgressionRequirement* questRequirement : ar->quests)
{
if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == player->GetTeamId(true))
if (!questRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
{
if (!player->GetQuestRewardStatus(questRequirement->id))
if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == player->GetTeamId(true))
{
lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
break;
if (!player->GetQuestRewardStatus(questRequirement->id))
{
lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
break;
}
}
}
}
@@ -461,12 +467,15 @@ namespace lfg
//Check if player has the required achievements
for (const ProgressionRequirement* achievementRequirement : ar->achievements)
{
if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == player->GetTeamId(true))
if (!achievementRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
{
if (!player->HasAchieved(achievementRequirement->id))
if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == player->GetTeamId(true))
{
lockData = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT;
break;
if (!player->HasAchieved(achievementRequirement->id))
{
lockData = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT;
break;
}
}
}
}
@@ -1054,7 +1063,7 @@ namespace lfg
maxPower = (p->getPowerType() == POWER_RAGE || p->getPowerType() == POWER_RUNIC_POWER) ? p->GetMaxPower(p->getPowerType()) / 10 : p->GetMaxPower(p->getPowerType());
currInternalInfoMap[sitr->first] = RBInternalInfo(guid, sitr->second.comment, !groupGuid.IsEmpty(), groupGuid, sitr->second.roles, encounterMask, instanceGuid,
1, p->getLevel(), p->getClass(), p->getRace(), p->GetAverageItemLevel(),
1, p->GetLevel(), p->getClass(), p->getRace(), p->GetAverageItemLevel(),
talents, p->GetAreaId(), p->GetArmor(), (uint32)std::max<int32>(0, spellDamage), (uint32)std::max<int32>(0, spellHeal),
p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + static_cast<uint16>(CR_CRIT_MELEE)), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + static_cast<uint16>(CR_CRIT_RANGED)), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + static_cast<uint16>(CR_CRIT_SPELL)), std::max<float>(0.0f, mp5), std::max<float>(0.0f, mp5combat),
std::max<uint32>(baseAP, rangedAP), (uint32)p->GetStat(STAT_AGILITY), p->GetMaxHealth(), maxPower, p->GetDefenseSkillValue(),
@@ -2258,7 +2267,7 @@ namespace lfg
if (uint8 count = GetRandomPlayersCount(player->GetGUID()))
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS, count);
LfgReward const* reward = GetRandomDungeonReward(rDungeonId, player->getLevel());
LfgReward const* reward = GetRandomDungeonReward(rDungeonId, player->GetLevel());
if (!reward)
continue;

View File

@@ -491,7 +491,7 @@ namespace lfg
/// Get leader of the group (using internal data)
ObjectGuid GetLeader(ObjectGuid guid);
/// Initializes locked dungeons for given player (called at login or level change)
void InitializeLockedDungeons(Player* player, uint8 level = 0);
void InitializeLockedDungeons(Player* player, Group const* group = nullptr);
/// Sets player team
void SetTeam(ObjectGuid guid, TeamId teamId);
/// Sets player group

View File

@@ -36,7 +36,7 @@ namespace lfg
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER | LFG_OPTION_ENABLE_SEASONAL_BOSSES))
return;
sLFGMgr->InitializeLockedDungeons(player);
sLFGMgr->InitializeLockedDungeons(player, player->GetGroup());
}
void LFGPlayerScript::OnLogout(Player* player)
@@ -68,7 +68,8 @@ namespace lfg
ObjectGuid guid = player->GetGUID();
ObjectGuid gguid = sLFGMgr->GetGroup(guid);
if (Group const* group = player->GetGroup())
Group const* group = player->GetGroup();
if (group)
{
ObjectGuid gguid2 = group->GetGUID();
if (gguid != gguid2)
@@ -77,7 +78,7 @@ namespace lfg
}
}
sLFGMgr->InitializeLockedDungeons(player);
sLFGMgr->InitializeLockedDungeons(player, group);
sLFGMgr->SetTeam(player->GetGUID(), player->GetTeamId());
// TODO - Restore LfgPlayerData and send proper status to player if it was in a group
}
@@ -86,7 +87,7 @@ namespace lfg
{
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL)
sLFGMgr->InitializeLockedDungeons(player);
sLFGMgr->InitializeLockedDungeons(player, player->GetGroup());
}
void LFGPlayerScript::OnMapChanged(Player* player)