mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Garrison: Always send response to GetGarrisonInfo, even if no garrison exists (#31336)
This commit is contained in:
@@ -301,7 +301,7 @@ void Garrison::Leave() const
|
||||
|
||||
GarrisonFactionIndex Garrison::GetFaction() const
|
||||
{
|
||||
return _owner->GetTeam() == HORDE ? GARRISON_FACTION_INDEX_HORDE : GARRISON_FACTION_INDEX_ALLIANCE;
|
||||
return GetFaction(_owner->GetTeam());
|
||||
}
|
||||
|
||||
std::vector<Garrison::Plot*> Garrison::GetPlots()
|
||||
@@ -530,20 +530,15 @@ Garrison::Follower const* Garrison::GetFollower(uint64 dbId) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Garrison::SendInfo()
|
||||
void Garrison::BuildInfoPacket(WorldPackets::Garrison::GarrisonInfo& garrison) const
|
||||
{
|
||||
WorldPackets::Garrison::GetGarrisonInfoResult garrisonInfo;
|
||||
garrisonInfo.FactionIndex = GetFaction();
|
||||
garrisonInfo.Garrisons.emplace_back();
|
||||
|
||||
WorldPackets::Garrison::GarrisonInfo& garrison = garrisonInfo.Garrisons.back();
|
||||
garrison.GarrTypeID = GetType();
|
||||
garrison.GarrSiteID = _siteLevel->GarrSiteID;
|
||||
garrison.GarrSiteLevelID = _siteLevel->ID;
|
||||
garrison.NumFollowerActivationsRemaining = _followerActivationsRemainingToday;
|
||||
for (auto& p : _plots)
|
||||
{
|
||||
Plot& plot = p.second;
|
||||
Plot const& plot = p.second;
|
||||
garrison.Plots.push_back(&plot.PacketInfo);
|
||||
if (plot.BuildingInfo.PacketInfo)
|
||||
garrison.Buildings.push_back(&*plot.BuildingInfo.PacketInfo);
|
||||
@@ -551,8 +546,6 @@ void Garrison::SendInfo()
|
||||
|
||||
for (auto const& p : _followers)
|
||||
garrison.Followers.push_back(&p.second.PacketInfo);
|
||||
|
||||
_owner->SendDirectMessage(garrisonInfo.Write());
|
||||
}
|
||||
|
||||
void Garrison::SendRemoteInfo() const
|
||||
|
||||
@@ -228,6 +228,7 @@ public:
|
||||
void Enter() const;
|
||||
void Leave() const;
|
||||
|
||||
static constexpr GarrisonFactionIndex GetFaction(Team team) { return team == HORDE ? GARRISON_FACTION_INDEX_HORDE : GARRISON_FACTION_INDEX_ALLIANCE; }
|
||||
GarrisonFactionIndex GetFaction() const;
|
||||
GarrisonType GetType() const { return GARRISON_TYPE_GARRISON; }
|
||||
GarrSiteLevelEntry const* GetSiteLevel() const { return _siteLevel; }
|
||||
@@ -259,7 +260,7 @@ public:
|
||||
return count;
|
||||
}
|
||||
|
||||
void SendInfo();
|
||||
void BuildInfoPacket(WorldPackets::Garrison::GarrisonInfo& garrison) const;
|
||||
void SendRemoteInfo() const;
|
||||
void SendBlueprintAndSpecializationData();
|
||||
void SendMapData(Player* receiver) const;
|
||||
|
||||
@@ -22,8 +22,13 @@
|
||||
|
||||
void WorldSession::HandleGetGarrisonInfo(WorldPackets::Garrison::GetGarrisonInfo& /*getGarrisonInfo*/)
|
||||
{
|
||||
WorldPackets::Garrison::GetGarrisonInfoResult garrisonInfo;
|
||||
garrisonInfo.FactionIndex = Garrison::GetFaction(_player->GetTeam());
|
||||
|
||||
if (Garrison* garrison = _player->GetGarrison())
|
||||
garrison->SendInfo();
|
||||
garrison->BuildInfoPacket(garrisonInfo.Garrisons.emplace_back());
|
||||
|
||||
SendPacket(garrisonInfo.Write());
|
||||
}
|
||||
|
||||
void WorldSession::HandleGarrisonPurchaseBuilding(WorldPackets::Garrison::GarrisonPurchaseBuilding& garrisonPurchaseBuilding)
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace WorldPackets
|
||||
uint32 NumFollowerActivationsRemaining = 0;
|
||||
uint32 NumMissionsStartedToday = 0; // might mean something else, but sending 0 here enables follower abilities "Increase success chance of the first mission of the day by %."
|
||||
int32 MinAutoTroopLevel = 0;
|
||||
std::vector<GarrisonPlotInfo*> Plots;
|
||||
std::vector<GarrisonPlotInfo const*> Plots;
|
||||
std::vector<GarrisonBuildingInfo const*> Buildings;
|
||||
std::vector<GarrisonFollower const*> Followers;
|
||||
std::vector<GarrisonFollower const*> AutoTroops;
|
||||
|
||||
Reference in New Issue
Block a user