Core/Housing: stage 31 reject expired active Initiative selection
This commit is contained in:
@@ -122,15 +122,17 @@ namespace Housing
|
||||
}
|
||||
|
||||
if (snapshot.InitiativeId != 0 || snapshot.State != 0 || snapshot.Progress != 0 ||
|
||||
snapshot.RewardTier != 0 || !snapshot.Activities.empty() || !snapshot.PlayerActivities.empty())
|
||||
snapshot.RewardTier != 0 || snapshot.StartedAt != 0 || snapshot.EndsAt != 0 || snapshot.Expired ||
|
||||
!snapshot.Activities.empty() || !snapshot.PlayerActivities.empty())
|
||||
{
|
||||
// The empty player-info form is verified and terminates after the flag byte.
|
||||
// Keep richer persisted Initiative state server-side until the current-client
|
||||
// trailing data block has been capture-verified.
|
||||
TC_LOG_DEBUG("housing",
|
||||
"Neighborhood {} has Initiative {} state {} progress {} reward tier {} with {} activities and {} player contributions; detailed wire publication is deferred",
|
||||
"Neighborhood {} has Initiative {} state {} progress {} reward tier {} start {} end {} expired {} with {} activities and {} player contributions; detailed wire publication is deferred",
|
||||
packet.NeighborhoodGUID.ToString(), snapshot.InitiativeId, uint32(snapshot.State), snapshot.Progress,
|
||||
uint32(snapshot.RewardTier), snapshot.Activities.size(), snapshot.PlayerActivities.size());
|
||||
uint32(snapshot.RewardTier), snapshot.StartedAt, snapshot.EndsAt, snapshot.Expired,
|
||||
snapshot.Activities.size(), snapshot.PlayerActivities.size());
|
||||
}
|
||||
|
||||
session->SendPacket(response.Write());
|
||||
@@ -155,6 +157,15 @@ namespace Housing
|
||||
|
||||
EnsureInitiativePersistence(house);
|
||||
|
||||
InitiativeProgressSnapshot snapshot;
|
||||
InitiativeProgressResult const loadResult = LoadInitiativeProgress(
|
||||
session->GetPlayer(), packet.NeighborhoodGUID, snapshot);
|
||||
if (loadResult != InitiativeProgressResult::Success)
|
||||
{
|
||||
session->SendPacket(response.Write());
|
||||
return;
|
||||
}
|
||||
|
||||
QueryResult persistedEntries = CharacterDatabase.PQuery(
|
||||
"SELECT COUNT(*) FROM housing_initiative_activity_log "
|
||||
"WHERE NeighborhoodGuid = '{}'",
|
||||
@@ -195,6 +206,26 @@ namespace Housing
|
||||
}
|
||||
|
||||
EnsureInitiativePersistence(house);
|
||||
|
||||
InitiativeProgressSnapshot snapshot;
|
||||
InitiativeProgressResult const loadResult = LoadInitiativeProgress(
|
||||
session->GetPlayer(), packet.NeighborhoodGUID, snapshot);
|
||||
if (loadResult != InitiativeProgressResult::Success)
|
||||
{
|
||||
TC_LOG_WARN("housing", "Failed to validate Initiative neighborhood {} before activation for player {}",
|
||||
packet.NeighborhoodGUID.ToString(),
|
||||
session->GetPlayer() ? session->GetPlayer()->GetGUID().ToString() : "<none>");
|
||||
return;
|
||||
}
|
||||
|
||||
if (snapshot.Expired)
|
||||
{
|
||||
TC_LOG_DEBUG("housing", "Rejected expired Initiative {} neighborhood {} for player {}",
|
||||
snapshot.InitiativeId, packet.NeighborhoodGUID.ToString(),
|
||||
session->GetPlayer() ? session->GetPlayer()->GetGUID().ToString() : "<none>");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PersistActiveNeighborhood(session, packet.NeighborhoodGUID))
|
||||
TC_LOG_WARN("housing", "Failed to persist active Initiative neighborhood {} for player {}",
|
||||
packet.NeighborhoodGUID.ToString(),
|
||||
|
||||
Reference in New Issue
Block a user