This class is a wrapper for snipe.server.data.UserLogicCore providing limited access to user logic state from within action scripts.

It is available only on Snipe Kit server.

Constructor

new (user:UserKit)

Methods

trigger (type:String, params:_LogicTriggerParams):Void

Activates node trigger, checks for node completion and completes the node if all completion requirements are met. Also handles node failure.

Usage examples:

// increases a counter
user.logic.trigger('counter',
  { name: 'money.given' });

// increases a counter by an amount
user.logic.trigger('counter',
  { name: 'money.given', amount: 10 });

// sets a counter to an amount
user.logic.trigger('counter',
  { name: 'money.given', action: 'set', amount: 10 });

// increases a conditional counter if "val" condition is met
user.logic.trigger('condCounter',
  { name: 'level.finishTime', val: finishTime });

// increases a conditional counter by an amount if "val" condition is met
user.logic.trigger('condCounter',
  { name: 'level.finishTime', val: finishTime, amount: 10 });

// sets a conditional counter to an amount if "val" condition is met
user.logic.trigger('condCounter',
  { name: 'level.finishTime', val: finishTime, action: 'set', amount: 10 });

// notifies nodes that an attribute has changed
user.logic.trigger('attr', { name: 'reputation' });

Parameters:

type

Trigger type. One of the following: attr, counter, condCounter, client or one of project-specific trigger types (handled by core/logic.trigger method subscription).

params

Trigger parameters.

outermostCall

If set to true, will reset skip on trigger flags in nodes.