fix(quickbuild): take precondition items when the build starts, give them back on cancel

A quickbuild's HasItem preconditions took their items only when the build
completed and never gave them back. Live took them when the build started
and gave them back when it was cancelled: the FV Stone Warrior pedestal
(LOT 8551, precondition 99: 5 of LOT 6194) took the items at Building 5
times and added them back with the loot source Quickbuild on each of the 3
cancels in the live captures.

Preconditions now report their item costs instead of removing items while
checking. A quickbuild takes them at the start, gives them back on cancel
or a reset during the build, keeps them on completion, and gives them back
when the builder leaves the world mid-build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 12:54:34 -05:00
parent 47814f1f74
commit b8a7ac897d
8 changed files with 180 additions and 34 deletions

View File

@@ -72,6 +72,7 @@
#include "Mail.h"
#include "TeamManager.h"
#include "SkillComponent.h"
#include "QuickBuildComponent.h"
#include "DestroyableComponent.h"
#include "Game.h"
#include "PropertyManagementComponent.h"
@@ -1201,6 +1202,9 @@ void CleanupDisconnectedUser(const SystemAddress& sysAddr) {
skillComponent->Reset();
}
// Give back the items a quickbuild took when the build started, before they are saved without them
QuickBuildComponent::CancelBuildsBy(*entity);
if (!savedByMigration) entity->GetCharacter()->SaveXMLToDatabase();
LOG("Deleting player %llu", entity->GetObjectID());