Core: stale trades, BG port ticket slot, vanilla mount rules and other fixes (#49)
- Trade: a trade request while a stale trade is still held cancels the old one instead of being ignored (no more "busy" until relog); Player::Update cancels a trade whose partner left the world, left the trade or went out of trade range - Battlegrounds: an accept with a wrong ticket slot is pointed at the queue the player was really invited from; a leave with an unknown slot removes the player from all of his queues - Battlegrounds: the invited counter never wraps below zero - Vanilla mount rules (Classic.MountIndoorsRules, default 1): no mounting indoors, none in the Warsong Gulch start rooms while the doors are closed, walking indoors dismounts; battlegrounds use the client's WMO group test - Group: initialize the ping restriction - WorldSession: with Load.Locales = 0 the session DB locale is enUS - Player: stored aura teleport locations are marked unchanged after save - Player: no empty battleground data row is written (REPLACE when there is data, DELETE otherwise) and empty PvP talent rows are skipped - Channel: invite and broadcasts skip the ignore check for a player without a social list (mid logout) - Control zones: no uint32 underflow in the capture time slope, superiority above maxSuperiority is capped - .revive: a dead GM with a living target selected revives himself - Terrain: mmap tiles that failed to load are not retried, a broken vmap tile is reported once - MSVC: /FS with /MP against C1041 parallel PDB errors Co-authored-by: Karrz1 <[email protected]>
This commit is contained in:
@@ -45,9 +45,11 @@ endif()
|
||||
|
||||
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||
# multithreaded compiling on VS
|
||||
# Forces writes to the PDB file to be serialized through mspdbsrv.exe (/FS), avoids C1041 with /MP
|
||||
target_compile_options(trinity-compile-option-interface
|
||||
INTERFACE
|
||||
/MP)
|
||||
/MP
|
||||
/FS)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# Forces writes to the PDB file to be serialized through mspdbsrv.exe (/FS)
|
||||
# Enable faster PDB generation in parallel builds by minimizing RPC calls to mspdbsrv.exe (/Zf)
|
||||
|
||||
@@ -453,7 +453,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_UPD_ARENA_TEAM_NAME, "UPDATE arena_team SET name = ? WHERE arenaTeamId = ?", CONNECTION_ASYNC);
|
||||
|
||||
// Character battleground data
|
||||
PrepareStatement(CHAR_INS_PLAYER_BGDATA, "INSERT INTO character_battleground_data (guid, instanceId, team, joinX, joinY, joinZ, joinO, joinMapId, taxiStart, taxiEnd, mountSpell, queueId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_PLAYER_BGDATA, "REPLACE INTO character_battleground_data (guid, instanceId, team, joinX, joinY, joinZ, joinO, joinMapId, taxiStart, taxiEnd, mountSpell, queueId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_PLAYER_BGDATA, "DELETE FROM character_battleground_data WHERE guid = ?", CONNECTION_ASYNC);
|
||||
|
||||
// Character homebind
|
||||
|
||||
@@ -45,8 +45,11 @@
|
||||
#include "ReputationMgr.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "TerrainMgr.h"
|
||||
#include "Transport.h"
|
||||
#include "Util.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager.h"
|
||||
#include "WorldStateMgr.h"
|
||||
#include <cstdarg>
|
||||
|
||||
@@ -514,6 +517,22 @@ WorldSafeLocsEntry const* Battleground::GetTeamStartPosition(TeamId teamId) cons
|
||||
return _battlegroundTemplate->StartLocation[teamId];
|
||||
}
|
||||
|
||||
bool Battleground::IsMountRefused(Player const* player, bool checkStartArea) const
|
||||
{
|
||||
if (checkStartArea && GetStatus() == STATUS_WAIT_JOIN && IsEnclosedStartArea(GetMapId()))
|
||||
return true;
|
||||
|
||||
if (!VMAP::VMapFactory::createOrGetVMapManager()->isLineOfSightCalcEnabled())
|
||||
return false;
|
||||
|
||||
// the wmo group under the player decides like on the client, not IsOutdoors(): its WMOAreaTable indoor override hits the wrong groups here
|
||||
Map* map = player->GetMap();
|
||||
uint32 mogpFlags = 0;
|
||||
int32 adtId = 0, rootId = 0, groupId = 0;
|
||||
return map->GetTerrain()->GetAreaInfo(player->GetPhaseShift(), map->GetId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(),
|
||||
mogpFlags, adtId, rootId, groupId) && IsIndoorWmoGroup(mogpFlags);
|
||||
}
|
||||
|
||||
float Battleground::GetStartMaxDist() const
|
||||
{
|
||||
return _battlegroundTemplate->MaxStartDistSq;
|
||||
|
||||
@@ -314,7 +314,9 @@ class TC_GAME_API Battleground
|
||||
void RemoveFromBGFreeSlotQueue(); //this method could delete whole BG instance, if another free is available
|
||||
void RemoveFromBGFreeSlotQueueOnShutdown() { m_InBGFreeSlotQueue = false; }
|
||||
|
||||
void DecreaseInvitedCount(Team team) { (team == ALLIANCE) ? --m_InvitedAlliance : --m_InvitedHorde; }
|
||||
// never below zero: a player who entered without a queue invitation was never counted, a wrapped counter closes the team for good
|
||||
void DecreaseInvitedCount(Team team) { uint32& invited = (team == ALLIANCE) ? m_InvitedAlliance : m_InvitedHorde; invited = AfterLeave(invited); }
|
||||
static constexpr uint32 AfterLeave(uint32 invited) { return invited ? invited - 1 : 0; }
|
||||
void IncreaseInvitedCount(Team team) { (team == ALLIANCE) ? ++m_InvitedAlliance : ++m_InvitedHorde; }
|
||||
|
||||
uint32 GetInvitedCount(Team team) const { return (team == ALLIANCE) ? m_InvitedAlliance : m_InvitedHorde; }
|
||||
@@ -347,6 +349,13 @@ class TC_GAME_API Battleground
|
||||
|
||||
WorldSafeLocsEntry const* GetTeamStartPosition(TeamId teamId) const;
|
||||
|
||||
// Classic.MountIndoorsRules: mounting is refused in an enclosed start area while the doors are closed (checkStartArea) and indoors
|
||||
bool IsMountRefused(Player const* player, bool checkStartArea) const;
|
||||
// Warsong Gulch starts in the closed flag rooms, the Arathi Basin and Alterac Valley start areas are open ground
|
||||
static constexpr bool IsEnclosedStartArea(uint32 mapId) { return mapId == 489; }
|
||||
// the client's indoor test on the MOGP flags of the wmo group: interior (0x2000) and not exterior (0x8)
|
||||
static constexpr bool IsIndoorWmoGroup(uint32 mogpFlags) { return (mogpFlags & 0x2000) != 0 && (mogpFlags & 0x8) == 0; }
|
||||
|
||||
float GetStartMaxDist() const;
|
||||
|
||||
// Packet Transfer
|
||||
|
||||
@@ -867,7 +867,7 @@ void Channel::Invite(Player const* player, std::string const& newname)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!newp->GetSocial()->HasIgnore(guid, player->GetSession()->GetAccountGUID()))
|
||||
if (!newp->GetSocial() || !newp->GetSocial()->HasIgnore(guid, player->GetSession()->GetAccountGUID()))
|
||||
{
|
||||
InviteAppend appender(guid);
|
||||
ChannelNameBuilder<InviteAppend> builder(this, appender);
|
||||
@@ -994,7 +994,7 @@ void Channel::SendToAll(Builder& builder, ObjectGuid const& guid, ObjectGuid con
|
||||
|
||||
for (PlayerContainer::value_type const& i : _playersStore)
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(i.first))
|
||||
if (guid.IsEmpty() || !player->GetSocial()->HasIgnore(guid, accountGuid))
|
||||
if (guid.IsEmpty() || !player->GetSocial() || !player->GetSocial()->HasIgnore(guid, accountGuid))
|
||||
localizer(player);
|
||||
}
|
||||
|
||||
@@ -1026,6 +1026,6 @@ void Channel::SendToAllWithAddon(Builder& builder, std::string const& addonPrefi
|
||||
|
||||
for (PlayerContainer::value_type const& i : _playersStore)
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(i.first))
|
||||
if (player->GetSession()->IsAddonRegistered(addonPrefix) && (guid.IsEmpty() || !player->GetSocial()->HasIgnore(guid, accountGuid)))
|
||||
if (player->GetSession()->IsAddonRegistered(addonPrefix) && (guid.IsEmpty() || !player->GetSocial() || !player->GetSocial()->HasIgnore(guid, accountGuid)))
|
||||
localizer(player);
|
||||
}
|
||||
|
||||
@@ -754,9 +754,13 @@ public:
|
||||
uint32 const maxTime = _owner.GetGOInfo()->controlZone.maxTime;
|
||||
uint32 const maxSuperiority = _owner.GetGOInfo()->controlZone.maxSuperiority;
|
||||
|
||||
float const slope = static_cast<float>(minTime - maxTime) / static_cast<float>(std::max<uint32>(maxSuperiority - minSuperiority, 1));
|
||||
// superiority above maxSuperiority captures at minTime, the line must not be extrapolated past it
|
||||
uint32 const cappedDelta = std::min(delta, std::max(maxSuperiority, minSuperiority));
|
||||
|
||||
// subtract as float, minTime - maxTime in uint32 underflows
|
||||
float const slope = (static_cast<float>(minTime) - static_cast<float>(maxTime)) / static_cast<float>(std::max<uint32>(maxSuperiority - minSuperiority, 1));
|
||||
float const intercept = static_cast<float>(maxTime) - slope * static_cast<float>(minSuperiority);
|
||||
return slope * static_cast<float>(delta) + intercept;
|
||||
return slope * static_cast<float>(cappedDelta) + intercept;
|
||||
}
|
||||
|
||||
void HandleUnitEnterExit(std::vector<Player*> const& newTargetList)
|
||||
|
||||
@@ -148,6 +148,8 @@
|
||||
#include "VehiclePackets.h"
|
||||
#include "Vignette.h"
|
||||
#include "VignettePackets.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
@@ -985,6 +987,8 @@ void Player::Update(uint32 p_time)
|
||||
|
||||
UpdateAfkReport(now);
|
||||
|
||||
UpdateTradeState();
|
||||
|
||||
if (GetCombatManager().HasPvPCombat())
|
||||
if (Aura* aura = GetAura(SPELL_PVP_RULES_ENABLED))
|
||||
if (!aura->IsPermanent())
|
||||
@@ -6809,6 +6813,23 @@ void Player::UpdateIndoorsOutdoorsAuras()
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_VMAP_INDOOR_CHECK))
|
||||
RemoveAurasWithAttribute(IsOutdoors() ? SPELL_ATTR0_ONLY_INDOORS : SPELL_ATTR0_ONLY_OUTDOORS);
|
||||
|
||||
// Classic: walking indoors dismounts
|
||||
if (HasAuraType(SPELL_AURA_MOUNTED) && IsMountRestrictedHere(false))
|
||||
RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
}
|
||||
|
||||
// Classic.MountIndoorsRules: the mount spells of the client data do not carry SPELL_ATTR0_ONLY_OUTDOORS
|
||||
bool Player::IsMountRestrictedHere(bool checkStartArea) const
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_CLASSIC_MOUNT_INDOORS_RULES))
|
||||
return false;
|
||||
|
||||
if (Battleground const* bg = GetBattleground(); bg && !bg->isArena())
|
||||
return bg->IsMountRefused(this, checkStartArea);
|
||||
|
||||
// the indoor state comes from the wmo data of the vmaps
|
||||
return !IsOutdoors() && VMAP::VMapFactory::createOrGetVMapManager()->isLineOfSightCalcEnabled();
|
||||
}
|
||||
|
||||
void Player::UpdateTavernRestingState()
|
||||
@@ -13890,6 +13911,33 @@ void Player::TradeCancel(bool sendback, TradeStatus status /*= TRADE_STATUS_CANC
|
||||
}
|
||||
}
|
||||
|
||||
// cancels a trade whose partner is gone or out of range, a stale trade would block any new one until relog
|
||||
void Player::UpdateTradeState()
|
||||
{
|
||||
if (!m_trade)
|
||||
return;
|
||||
|
||||
Player* trader = m_trade->GetTrader();
|
||||
|
||||
// a partner on another map is updated by another thread, a new trade request or a logout clears that trade
|
||||
if (trader->IsInWorld() && trader->GetMap() != GetMap())
|
||||
return;
|
||||
|
||||
if (!trader->m_trade || trader->m_trade->GetTrader() != this)
|
||||
{
|
||||
// the partner is no longer in this trade, only our side is left
|
||||
GetSession()->SendCancelTrade(TRADE_STATUS_CANCELLED);
|
||||
delete m_trade;
|
||||
m_trade = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!trader->IsInWorld())
|
||||
TradeCancel(true);
|
||||
else if (!IsWithinDistInMap(trader, TRADE_DISTANCE, false))
|
||||
TradeCancel(true, TRADE_STATUS_TOO_FAR_AWAY);
|
||||
}
|
||||
|
||||
void Player::UpdateSoulboundTradeItems()
|
||||
{
|
||||
// also checks for garbage data
|
||||
@@ -22342,6 +22390,8 @@ void Player::_SaveStoredAuraTeleportLocations(CharacterDatabaseTransaction trans
|
||||
stmt->setFloat(5, storedLocation.Loc.GetPositionZ());
|
||||
stmt->setFloat(6, storedLocation.Loc.GetOrientation());
|
||||
trans->Append(stmt);
|
||||
|
||||
storedLocation.State = StoredAuraTeleportLocation::UNCHANGED;
|
||||
}
|
||||
|
||||
++itr;
|
||||
@@ -29270,11 +29320,24 @@ void Player::_SaveTransmogOutfits(CharacterDatabaseTransaction trans)
|
||||
|
||||
void Player::_SaveBGData(CharacterDatabaseTransaction trans)
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_BGDATA);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
bool const hasBgData = m_bgData.bgInstanceID != 0
|
||||
|| m_bgData.bgTeam != TEAM_OTHER
|
||||
|| m_bgData.joinPos.GetMapId() != MAPID_INVALID
|
||||
|| m_bgData.taxiPath[0] || m_bgData.taxiPath[1]
|
||||
|| m_bgData.mountSpell
|
||||
|| m_bgData.queueId != BATTLEGROUND_QUEUE_NONE;
|
||||
|
||||
// one statement per save: an all-empty row is never written, a row left by earlier data is removed
|
||||
if (!hasBgData)
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_BGDATA);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
return;
|
||||
}
|
||||
|
||||
/* guid, bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_BGDATA);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_BGDATA);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, m_bgData.bgInstanceID);
|
||||
stmt->setUInt16(2, m_bgData.bgTeam);
|
||||
@@ -29622,6 +29685,11 @@ void Player::_SaveTalents(CharacterDatabaseTransaction trans)
|
||||
for (uint8 group = 0; group < MAX_SPECIALIZATIONS; ++group)
|
||||
{
|
||||
PlayerPvpTalentMap const& talents = GetPvpTalentMap(group);
|
||||
|
||||
// an empty row loads the same as no row
|
||||
if (std::ranges::all_of(talents, [](uint32 talentId) { return talentId == 0; }))
|
||||
continue;
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_PVP_TALENT);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, talents[0]);
|
||||
|
||||
@@ -1676,6 +1676,7 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
Player* GetTrader() const;
|
||||
TradeData* GetTradeData() const { return m_trade; }
|
||||
void TradeCancel(bool sendback, TradeStatus status = TRADE_STATUS_CANCELLED);
|
||||
void UpdateTradeState();
|
||||
|
||||
CinematicMgr* GetCinematicMgr() const { return _cinematicMgr.get(); }
|
||||
|
||||
@@ -2488,6 +2489,7 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
// These methods are used to periodically update certain area and aura based mechanics used in Heartbeat and Movement
|
||||
void UpdateZoneAndAreaId();
|
||||
void UpdateIndoorsOutdoorsAuras();
|
||||
bool IsMountRestrictedHere(bool checkStartArea) const;
|
||||
void UpdateTavernRestingState();
|
||||
|
||||
static Team TeamForRace(uint8 race);
|
||||
|
||||
@@ -61,7 +61,8 @@ Group::Group() : m_leaderGuid(), m_leaderFactionGroup(0), m_leaderName(""), m_gr
|
||||
m_dungeonDifficulty(DIFFICULTY_NORMAL), m_raidDifficulty(DIFFICULTY_NORMAL_RAID), m_legacyRaidDifficulty(DIFFICULTY_10_N),
|
||||
m_bgGroup(nullptr), m_bfGroup(nullptr), m_lootMethod(PERSONAL_LOOT), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(),
|
||||
m_masterLooterGuid(), m_subGroupsCounts(nullptr), m_guid(), m_dbStoreId(0), m_isLeaderOffline(false),
|
||||
m_readyCheckStarted(false), m_readyCheckTimer(Milliseconds::zero()), m_activeMarkers(0), m_scriptRef(this, NoopGroupDeleter())
|
||||
m_readyCheckStarted(false), m_readyCheckTimer(Milliseconds::zero()), m_activeMarkers(0), m_pingRestriction(RestrictPingsTo::None),
|
||||
m_scriptRef(this, NoopGroupDeleter())
|
||||
{
|
||||
for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
|
||||
m_targetIcons[i].Clear();
|
||||
|
||||
@@ -315,12 +315,58 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPackets::Battleground::Battl
|
||||
return;
|
||||
}
|
||||
|
||||
// a leave whose ticket slot names none of our queues removes the player from the queues he really is in,
|
||||
// otherwise he stays stuck in a queue the client cannot leave
|
||||
auto leaveAllQueues = [&]
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
{
|
||||
BattlegroundQueueTypeId queued = _player->GetBattlegroundQueueTypeId(i);
|
||||
if (queued == BATTLEGROUND_QUEUE_NONE)
|
||||
continue;
|
||||
|
||||
WorldPackets::Battleground::BattlefieldStatusNone battlefieldStatus;
|
||||
battlefieldStatus.Ticket = battlefieldPort.Ticket;
|
||||
battlefieldStatus.Ticket.Id = i;
|
||||
SendPacket(battlefieldStatus.Write());
|
||||
|
||||
_player->RemoveBattlegroundQueueId(queued);
|
||||
sBattlegroundMgr->GetBattlegroundQueue(queued).RemovePlayer(_player->GetGUID(), true);
|
||||
}
|
||||
};
|
||||
|
||||
// an accept with a ticket slot that is not the invited queue is pointed at the queue the player was really invited from
|
||||
if (battlefieldPort.AcceptedInvite)
|
||||
{
|
||||
auto isInvited = [&](BattlegroundQueueTypeId queued)
|
||||
{
|
||||
GroupQueueInfo info;
|
||||
return queued != BATTLEGROUND_QUEUE_NONE
|
||||
&& sBattlegroundMgr->GetBattlegroundQueue(queued).GetPlayerGroupInfoData(_player->GetGUID(), &info)
|
||||
&& info.IsInvitedToBGInstanceGUID;
|
||||
};
|
||||
|
||||
if (!isInvited(_player->GetBattlegroundQueueTypeId(battlefieldPort.Ticket.Id)))
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
{
|
||||
if (isInvited(_player->GetBattlegroundQueueTypeId(i)))
|
||||
{
|
||||
battlefieldPort.Ticket.Id = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BattlegroundQueueTypeId bgQueueTypeId = _player->GetBattlegroundQueueTypeId(battlefieldPort.Ticket.Id);
|
||||
if (bgQueueTypeId == BATTLEGROUND_QUEUE_NONE)
|
||||
{
|
||||
TC_LOG_DEBUG("bg.battleground", "CMSG_BATTLEFIELD_PORT {} Slot: {}, Unk: {}, Time: {}, AcceptedInvite: {}. Invalid queueSlot!",
|
||||
GetPlayerInfo(), battlefieldPort.Ticket.Id, uint32(battlefieldPort.Ticket.Type), battlefieldPort.Ticket.Time.AsUnderlyingType(), uint32(battlefieldPort.AcceptedInvite));
|
||||
sScriptMgr->OnPlayerBattlegroundPortFailed(_player, /*invalid queue slot*/ 2, 0);
|
||||
if (!battlefieldPort.AcceptedInvite)
|
||||
leaveAllQueues();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -333,6 +379,8 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPackets::Battleground::Battl
|
||||
TC_LOG_DEBUG("bg.battleground", "CMSG_BATTLEFIELD_PORT {} Slot: {}, Unk: {}, Time: {}, AcceptedInvite: {}. Player not in queue (No player Group Info)!",
|
||||
GetPlayerInfo(), battlefieldPort.Ticket.Id, uint32(battlefieldPort.Ticket.Type), battlefieldPort.Ticket.Time.AsUnderlyingType(), uint32(battlefieldPort.AcceptedInvite));
|
||||
sScriptMgr->OnPlayerBattlegroundPortFailed(_player, /*no group info*/ 3, 0);
|
||||
if (!battlefieldPort.AcceptedInvite)
|
||||
leaveAllQueues();
|
||||
return;
|
||||
}
|
||||
// if action == 1, then player must have been invited to join
|
||||
|
||||
@@ -607,8 +607,9 @@ void WorldSession::HandleCancelTradeOpcode(WorldPackets::Trade::CancelTrade& /*c
|
||||
|
||||
void WorldSession::HandleInitiateTradeOpcode(WorldPackets::Trade::InitiateTrade& initiateTrade)
|
||||
{
|
||||
// the client only asks for a trade when it has none open, a trade still held here is stale
|
||||
if (GetPlayer()->m_trade)
|
||||
return;
|
||||
GetPlayer()->TradeCancel(true);
|
||||
|
||||
WorldPackets::Trade::TradeStatus info;
|
||||
if (!GetPlayer()->IsAlive())
|
||||
|
||||
@@ -229,7 +229,12 @@ void TerrainInfo::LoadVMap(int32 gx, int32 gy)
|
||||
break;
|
||||
case VMAP::LoadResult::VersionMismatch:
|
||||
case VMAP::LoadResult::ReadFromFileFailed:
|
||||
TC_LOG_ERROR("maps", "Could not load VMAP name:{}, id:{}, x:{}, y:{} (vmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy);
|
||||
// the tile is still loaded (and unloaded) every time so the vmap tile refs stay balanced, only the error is reported once
|
||||
if (!_vmapLoadFailed[GetBitsetIndex(gx, gy)])
|
||||
{
|
||||
_vmapLoadFailed[GetBitsetIndex(gx, gy)] = true;
|
||||
TC_LOG_ERROR("maps", "Could not load VMAP name:{}, id:{}, x:{}, y:{} (vmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy);
|
||||
}
|
||||
break;
|
||||
case VMAP::LoadResult::DisabledInConfig:
|
||||
TC_LOG_DEBUG("maps", "Ignored VMAP name:{}, id:{}, x:{}, y:{} (vmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy);
|
||||
@@ -244,21 +249,34 @@ void TerrainInfo::LoadMMapImpl(uint32 instanceId, int32 gx, int32 gy)
|
||||
if (!DisableMgr::IsPathfindingEnabled(GetId()))
|
||||
return;
|
||||
|
||||
switch (MMAP::LoadResult mmapLoadResult = MMAP::MMapManager::instance()->loadMap(sWorld->GetDataPath(), GetId(), instanceId, gx, gy))
|
||||
// a missing or broken tile is not retried (every instance of the map would try it again)
|
||||
{
|
||||
std::scoped_lock lock(_loadMutex);
|
||||
if (_mmapLoadFailed[GetBitsetIndex(gx, gy)])
|
||||
return;
|
||||
}
|
||||
|
||||
MMAP::LoadResult mmapLoadResult = MMAP::MMapManager::instance()->loadMap(sWorld->GetDataPath(), GetId(), instanceId, gx, gy);
|
||||
switch (mmapLoadResult)
|
||||
{
|
||||
case MMAP::LoadResult::Success:
|
||||
TC_LOG_DEBUG("mmaps.tiles", "MMAP loaded name:{}, id:{}, x:{}, y:{} (mmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy);
|
||||
break;
|
||||
return;
|
||||
case MMAP::LoadResult::AlreadyLoaded:
|
||||
break;
|
||||
case MMAP::LoadResult::FileNotFound:
|
||||
if (_parentTerrain)
|
||||
break; // don't log tile not found errors for child maps
|
||||
[[fallthrough]];
|
||||
return;
|
||||
default:
|
||||
TC_LOG_WARN("mmaps.tiles", "Could not load MMAP name:{}, id:{}, x:{}, y:{} (mmap rep.: x:{}, y:{}) result: {}", GetMapName(), GetId(), gx, gy, gx, gy, AsUnderlyingType(mmapLoadResult));
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
std::scoped_lock lock(_loadMutex);
|
||||
_mmapLoadFailed[GetBitsetIndex(gx, gy)] = true;
|
||||
}
|
||||
|
||||
if (mmapLoadResult == MMAP::LoadResult::FileNotFound && _parentTerrain)
|
||||
return; // don't log tile not found errors for child maps
|
||||
|
||||
TC_LOG_WARN("mmaps.tiles", "Could not load MMAP name:{}, id:{}, x:{}, y:{} (mmap rep.: x:{}, y:{}) result: {}", GetMapName(), GetId(), gx, gy, gx, gy, AsUnderlyingType(mmapLoadResult));
|
||||
}
|
||||
|
||||
void TerrainInfo::UnloadMap(int32 gx, int32 gy)
|
||||
|
||||
@@ -115,6 +115,8 @@ private:
|
||||
std::atomic<uint16> _referenceCountFromMap[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
||||
std::array<uint64, MAX_NUMBER_OF_GRIDS> _loadedGrids;
|
||||
std::bitset<MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS> _gridFileExists; // cache what grids are available for this map (not including parent/child maps)
|
||||
std::bitset<MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS> _vmapLoadFailed; // vmap tiles that failed to load, reported once
|
||||
std::bitset<MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS> _mmapLoadFailed; // mmap tiles that failed to load, not retried
|
||||
|
||||
static constexpr Milliseconds CleanupInterval = 1min;
|
||||
|
||||
|
||||
@@ -131,7 +131,8 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun
|
||||
m_playerRecentlyLogout(false),
|
||||
m_playerSave(false),
|
||||
m_sessionDbcLocale(sWorld->GetAvailableDbcLocale(locale)),
|
||||
m_sessionDbLocaleIndex(locale),
|
||||
// Load.Locales=0 loads enUS strings only, other locales would get empty query data
|
||||
m_sessionDbLocaleIndex(sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) ? locale : DEFAULT_LOCALE),
|
||||
_timezoneOffset(timezoneOffset),
|
||||
m_latency(0),
|
||||
_tutorials(),
|
||||
|
||||
@@ -6976,6 +6976,11 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32
|
||||
SendMountResult(MountResult::Shapeshifted); // mount result gets sent before the cast result
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
// Classic: no mounting indoors, nor in a closed battleground start room
|
||||
if (!IsTriggered())
|
||||
if (Player const* player = unitCaster->ToPlayer(); player && player->IsMountRestrictedHere(true))
|
||||
return SPELL_FAILED_ONLY_OUTDOORS;
|
||||
break;
|
||||
}
|
||||
case SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS:
|
||||
|
||||
@@ -698,6 +698,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
{ .Name = "Loot.EnableAELoot"sv, .DefaultValue = true, .Index = CONFIG_ENABLE_AE_LOOT },
|
||||
{ .Name = "Loot.SharedEncounterLoot"sv, .DefaultValue = true, .Index = CONFIG_LOOT_SHARED_ENCOUNTER_LOOT },
|
||||
{ .Name = "Load.Locales"sv, .DefaultValue = true, .Index = CONFIG_LOAD_LOCALES },
|
||||
{ .Name = "Classic.MountIndoorsRules"sv, .DefaultValue = true, .Index = CONFIG_CLASSIC_MOUNT_INDOORS_RULES },
|
||||
} };
|
||||
|
||||
static constexpr ConfigOptionLoadDefinitionArray<uint32, INT_CONFIG_VALUE_COUNT> ints =
|
||||
|
||||
@@ -202,6 +202,7 @@ enum WorldBoolConfigs : uint32
|
||||
CONFIG_ENABLE_AE_LOOT,
|
||||
CONFIG_LOOT_SHARED_ENCOUNTER_LOOT,
|
||||
CONFIG_LOAD_LOCALES,
|
||||
CONFIG_CLASSIC_MOUNT_INDOORS_RULES,
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -659,6 +659,11 @@ public:
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
|
||||
return false;
|
||||
|
||||
// a dead GM with a living player selected and no name given revives himself
|
||||
if (target && (!args || !*args) && handler->GetSession())
|
||||
if (Player* self = handler->GetSession()->GetPlayer(); self && !self->IsAlive() && target != self && target->IsAlive())
|
||||
target = self;
|
||||
|
||||
if (target)
|
||||
{
|
||||
target->SetHardcoreReviveAllowed(true); // Classic 1.60 Hardcore realms: staff revive is the one allowed resurrection
|
||||
|
||||
@@ -4637,6 +4637,15 @@ Classic.ClientMainGroupInsertIndex = 315
|
||||
|
||||
Classic.OfficialFeatureFlags = 1
|
||||
|
||||
# Classic.MountIndoorsRules
|
||||
# Description: Vanilla mount rules: no mounting indoors (buildings, caves), walking indoors dismounts, and no mounting
|
||||
# in the Warsong Gulch start rooms while the doors are closed. The indoor test uses the WMO flags of
|
||||
# the vmaps (needs vmap.enableLOS).
|
||||
# Default: 1 - (Enabled)
|
||||
# 0 - (Disabled)
|
||||
|
||||
Classic.MountIndoorsRules = 1
|
||||
|
||||
# Classic.Shop.Enabled
|
||||
# Description: In-game Store: shop points, products from world.shop_* (.shop reload), the Gold Market, character
|
||||
# services, realm transfers and the character screen boost. 0 answers like the official server
|
||||
|
||||
Reference in New Issue
Block a user