Housing: Complete initiative persistence — task progress, milestones, rewards
- Add neighborhood_initiative_task_progress table persisting per-task progress and status (NOT_STARTED/IN_PROGRESS/COMPLETE) across server restarts - Add neighborhood_initiative_milestones table persisting milestone reached state with timestamps - Add neighborhood_initiative_reward_claims table tracking per-player reward claims to prevent double-claiming - Implement PersistSingleTaskProgress, PersistMilestoneReached, PersistRewardClaim with corresponding CHAR_REP/INS prepared statements - LoadFromDB now restores task progress, milestone state, and reward claims from DB instead of defaulting to zero/recalculating - Implement ClaimMilestoneReward with full DB2 reward chain: walks InitiativeRewardXMilestone → InitiativeReward to grant currency, items, or favor based on RewardType - HasUnclaimedRewards now checks per-player claim state, not just milestone reached - HandleGetInitiativeClaimRewardRequest and HandleGetInitiativeOpenChestRequest now use ClaimMilestoneReward for actual reward distribution - PersistTaskProgress stub replaced with full implementation
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
DROP TABLE IF EXISTS `neighborhood_initiative_task_progress`;
|
||||
CREATE TABLE `neighborhood_initiative_task_progress` (
|
||||
`initiativeDbId` BIGINT UNSIGNED NOT NULL COMMENT 'FK to neighborhood_initiatives.id',
|
||||
`taskId` INT UNSIGNED NOT NULL COMMENT 'InitiativeTask DB2 entry ID',
|
||||
`progress` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Current progress count towards TargetCount',
|
||||
`status` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '0=NOT_STARTED, 1=IN_PROGRESS, 2=COMPLETE',
|
||||
PRIMARY KEY (`initiativeDbId`, `taskId`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- 13. neighborhood_initiative_milestones - Milestone reached/claimed tracking
|
||||
--
|
||||
-- Tracks which milestones have been reached for each initiative instance,
|
||||
-- and whether individual players have claimed their rewards.
|
||||
-- ---------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `neighborhood_initiative_milestones`;
|
||||
CREATE TABLE `neighborhood_initiative_milestones` (
|
||||
`initiativeDbId` BIGINT UNSIGNED NOT NULL COMMENT 'FK to neighborhood_initiatives.id',
|
||||
`milestoneIndex` INT UNSIGNED NOT NULL COMMENT 'Milestone index (0, 1, 2)',
|
||||
`reached` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '1 = milestone has been reached',
|
||||
`reachedTime` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Unix timestamp when milestone was reached',
|
||||
PRIMARY KEY (`initiativeDbId`, `milestoneIndex`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- 14. neighborhood_initiative_reward_claims - Per-player reward claim tracking
|
||||
--
|
||||
-- Tracks which players have claimed rewards for which milestones.
|
||||
-- Prevents double-claiming.
|
||||
-- ---------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS `neighborhood_initiative_reward_claims`;
|
||||
CREATE TABLE `neighborhood_initiative_reward_claims` (
|
||||
`initiativeDbId` BIGINT UNSIGNED NOT NULL COMMENT 'FK to neighborhood_initiatives.id',
|
||||
`milestoneIndex` INT UNSIGNED NOT NULL COMMENT 'Milestone index (0, 1, 2)',
|
||||
`playerGuid` BIGINT UNSIGNED NOT NULL COMMENT 'Player character GUID',
|
||||
`claimTime` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Unix timestamp when reward was claimed',
|
||||
PRIMARY KEY (`initiativeDbId`, `milestoneIndex`, `playerGuid`),
|
||||
INDEX `idx_player` (`playerGuid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
Reference in New Issue
Block a user