6c590ca520
- client.Effects: typed effects + completion methods posting scenario callbacks - client.Scenario reduced to TriggerAsync - pending polling via Update() pump: 30s heartbeat + wait-deadline checks - local engine, plan persistence (IPlanStateStore) and resume removed - RealtimeService and realtime transports removed (relay never deployed) - dead IPlanScheduler leftover removed - models regenerated from openapi (ExecutionPlan/BoundaryNode gone, PendingEffect added)
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace RudderSdk.Core;
|
|
|
|
/// <summary>
|
|
/// A scenario battle-pass-level node — a single claimable tier.
|
|
/// <see cref="ClaimAsync"/> posts <c>onComplete</c>, which the server accepts
|
|
/// only once the player has reached the node's configured level.
|
|
/// </summary>
|
|
public sealed class BattlePassLevelEffect
|
|
{
|
|
private readonly EffectHandle _handle;
|
|
|
|
internal BattlePassLevelEffect(EffectHandle handle) => _handle = handle;
|
|
|
|
/// <summary>Run id.</summary>
|
|
public string RunId => _handle.RunId;
|
|
|
|
/// <summary>Scenario id.</summary>
|
|
public string ScenarioId => _handle.ScenarioId;
|
|
|
|
/// <summary>Node id.</summary>
|
|
public string NodeId => _handle.NodeId;
|
|
|
|
/// <summary>The tier level this node claims.</summary>
|
|
public int Level => _handle.Get("levelNumber", 0);
|
|
|
|
/// <summary>Node data payload.</summary>
|
|
public JObject Data => _handle.Data;
|
|
|
|
/// <summary>Reads a typed value from the node data.</summary>
|
|
public T Get<T>(string key, T defaultValue = default!) => _handle.Get(key, defaultValue);
|
|
|
|
/// <summary>Claims this tier; posts <c>onComplete</c>.</summary>
|
|
public Task ClaimAsync(CancellationToken cancellationToken = default) => _handle.CompleteAsync("onComplete", cancellationToken);
|
|
|
|
/// <summary>Claims this tier (fire-and-forget).</summary>
|
|
public void Claim() => _handle.Complete("onComplete");
|
|
}
|