Modifier and Type | Class | Description |
---|---|---|
protected static class |
DefaultTriggerer.Trigger |
|
protected class |
DefaultTriggerer.TrigState |
|
protected class |
DefaultTriggerer.TrigTracker |
Triggerer.TriggerCode, Triggerer.TrigSignal
Modifier and Type | Field | Description |
---|---|---|
protected java.util.Map<java.lang.Object,MOB> |
assisting |
|
protected java.lang.String |
holyName |
|
protected java.util.Set<java.lang.String> |
ignoreOf |
|
protected static java.util.Map<java.lang.String,DefaultTriggerer.Trigger[]> |
ritualCache |
|
protected java.util.Map<java.lang.Object,DefaultTriggerer.Trigger[]> |
rituals |
|
protected java.util.Map<java.lang.String,java.util.List<Social>> |
socialsMap |
|
protected java.util.Map<java.lang.String,DefaultTriggerer.TrigTracker> |
trackers |
|
protected int |
version |
|
protected java.util.List<DefaultTriggerer.TrigState> |
waitingFor |
idConverter
Constructor | Description |
---|---|
DefaultTriggerer() |
Modifier and Type | Method | Description |
---|---|---|
void |
addTrigger(java.lang.Object key,
java.lang.String trigger,
java.util.Map<java.lang.String,java.util.List<Social>> socials,
java.util.List<java.lang.String> errors) |
Parses and adds a new series of steps, which together form
a complete trigger.
|
void |
addTriggerAssist(MOB assistingM,
java.lang.Object key) |
If a trigger allows otherwise non-qualifying participants,
this will allow it to add other participants to the message
listener for their main triggerer and key, using the INCLUDE
trigger directive.
|
protected void |
clearState(MOB mob,
java.lang.Object type) |
|
int |
compareTo(CMObject o) |
|
boolean |
containsString(java.lang.String toSrchStr,
java.lang.String srchForStr) |
|
CMObject |
copyOf() |
Similar to Cloneable.clone(), but does its best to make sure that
any internal objects to this class are also copyOfed.
|
void |
deleteTracking(MOB mob,
java.lang.Object key) |
If the given trigger key is in progress by the given mob,
this cancels it entirely.
|
CMMsg |
genNextAbleTrigger(MOB hostM,
MOB mob,
java.lang.Object key,
boolean force) |
Generates a message for the next step in the
tracked trigger denoted by the given trigger
key.
|
protected int |
getCMMsgCode(Triggerer.TriggerCode trig) |
|
Triad<MOB,java.lang.Object,java.util.List<java.lang.String>> |
getCompleted(MOB hostM,
java.lang.Object[] keys,
CMMsg msg) |
Given a set of trigger keys that may be progressed or
completed by the given message, this will progress them, and
then return the first one which , because of the message, is
now in a completed state, along with any args accumulated.
|
protected DefaultTriggerer.TrigState |
getCreateTrigState(MOB mob,
java.lang.Object key) |
|
protected DefaultTriggerer.TrigTracker |
getCreateTrigTracker(MOB mob) |
|
java.lang.Object[] |
getInProgress(MOB mob) |
Returns the trigger keys for any triggers that the given
mob currently has in progress.
|
java.util.Map<java.lang.String,java.util.List<Social>> |
getSocialSets() |
Returns the internal socials applicable to this trigger.
|
java.lang.String |
getTriggerDesc(java.lang.Object key) |
Returns a description of the trigger steps
of the given trigger key
|
protected DefaultTriggerer.TrigState |
getTrigState(MOB mob,
java.lang.Object key) |
|
protected DefaultTriggerer.TrigTracker |
getTrigTracker(MOB mob) |
|
boolean |
hasTrigger(java.lang.Object key) |
Returns whether a trigger with the given key is being tracked here.
|
java.lang.String |
ID() |
The CoffeeMud Java Class ID shared by all instances of
this object.
|
void |
initializeClass() |
Called ONCE after all objects are loaded, but before the map is read in
during initialization.
|
boolean |
isCompleted(java.lang.Object key,
CMMsg msg) |
Given a trigger key, and a message which may be progressed
completed by the given message, this will progress it, and
then return true if it was completed.
|
boolean |
isDisabled() |
If this triggering engine is disabled, this will return true
|
protected boolean |
isIgnoring(MOB mob) |
|
boolean |
isObsolete() |
If something has changed that requires a triggerer or tracker to
be reset, then every instance is notified, and this method can
be called to see if this specific object needs resetting.
|
boolean |
isTracking(MOB mob,
java.lang.Object key) |
Returns whether the given trigger key is in progress
by the given mob
|
boolean |
isTracking(java.lang.Object key,
CMMsg msg) |
Given a message and a trigger key, this will see if
the message might begin, progress, or complete the
given trigger steps.
|
protected java.lang.String |
L(java.lang.String str,
java.lang.String... xs) |
|
java.lang.String |
name() |
The displayable name of this object.
|
CMObject |
newInstance() |
Returns a new instance of this class.
|
void |
setIgnoreTracking(MOB mob,
boolean truefalse) |
Sets the given mob as being ignored for the purpose of
tracking, or re-enables tracking.
|
Triggerer |
setName(java.lang.String name) |
Some triggers benefit from unique names, and in those cases,
this allows that name to be set for proper matching.
|
void |
setObsolete() |
If this triggering engine needs disabling due to changes in
local abilities, this method can be called.
|
protected DefaultTriggerer.TrigState |
stepGetCompleted(MOB hostM,
java.lang.Object key,
CMMsg msg) |
|
protected java.lang.String |
targName(Environmental target) |
|
boolean |
wasCompletedRecently(MOB mob,
java.lang.Object key) |
Returns whether the given mob recently completed the trigger
with the given key, typically within 4 seconds.
|
java.lang.Object[] |
whichCompleted(java.lang.Object[] keys,
CMMsg msg) |
Given a set of trigger keys that may be progressed or
completed by the given message, this will progress them, and
then return the set of keys which, because of the message, are
now in a completed state.
|
java.lang.Object[] |
whichTracking(CMMsg msg) |
Given a message, this will check all triggers to see if
the message might begin, progress, or complete one of the
triggers.
|
MOB[] |
whosDoneWaiting() |
If any triggers are currently in a wait state, this will return
which ones, as of the moment this method was called, are now
done waiting.
|
protected static final java.util.Map<java.lang.String,DefaultTriggerer.Trigger[]> ritualCache
protected java.util.Map<java.lang.String,DefaultTriggerer.TrigTracker> trackers
protected java.util.Map<java.lang.Object,MOB> assisting
protected java.util.Map<java.lang.Object,DefaultTriggerer.Trigger[]> rituals
protected java.util.List<DefaultTriggerer.TrigState> waitingFor
protected java.util.Set<java.lang.String> ignoreOf
protected java.lang.String holyName
protected int version
protected java.util.Map<java.lang.String,java.util.List<Social>> socialsMap
public java.lang.String ID()
CMObject
public CMObject newInstance()
CMObject
newInstance
in interface CMObject
public java.lang.String name()
CMObject
name
in interface CMObject
Environmental.Name()
public Triggerer setName(java.lang.String name)
Triggerer
public boolean isObsolete()
Triggerer
isObsolete
in interface Triggerer
Triggerer.setObsolete()
public void setObsolete()
Triggerer
setObsolete
in interface Triggerer
Triggerer.isObsolete()
public boolean isDisabled()
Triggerer
isDisabled
in interface Triggerer
protected boolean isIgnoring(MOB mob)
public void addTrigger(java.lang.Object key, java.lang.String trigger, java.util.Map<java.lang.String,java.util.List<Social>> socials, java.util.List<java.lang.String> errors)
Triggerer
addTrigger
in interface Triggerer
key
- the arbitrary but unique key objecttrigger
- the encoded trigger stepssocials
- null, or list of custom socials that might apply to this triggererrors
- null, or a list to put errors intoprotected DefaultTriggerer.TrigTracker getTrigTracker(MOB mob)
protected DefaultTriggerer.TrigTracker getCreateTrigTracker(MOB mob)
protected DefaultTriggerer.TrigState getCreateTrigState(MOB mob, java.lang.Object key)
protected DefaultTriggerer.TrigState getTrigState(MOB mob, java.lang.Object key)
protected void clearState(MOB mob, java.lang.Object type)
protected java.lang.String L(java.lang.String str, java.lang.String... xs)
public java.lang.String getTriggerDesc(java.lang.Object key)
Triggerer
getTriggerDesc
in interface Triggerer
key
- the arbitrary but unique key objectpublic void setIgnoreTracking(MOB mob, boolean truefalse)
Triggerer
setIgnoreTracking
in interface Triggerer
mob
- the mob to checktruefalse
- true to turn on ignoring, false otherwisepublic void deleteTracking(MOB mob, java.lang.Object key)
Triggerer
deleteTracking
in interface Triggerer
mob
- the mob to checkkey
- the arbitrary but unique key objectpublic CMMsg genNextAbleTrigger(MOB hostM, MOB mob, java.lang.Object key, boolean force)
Triggerer
genNextAbleTrigger
in interface Triggerer
hostM
- TODOmob
- the mob to checkkey
- the arbitrary but unique key objectforce
- true to force even an unstarted triggerprotected int getCMMsgCode(Triggerer.TriggerCode trig)
public boolean isTracking(MOB mob, java.lang.Object key)
Triggerer
isTracking
in interface Triggerer
mob
- the mob to checkkey
- the arbitrary but unique key objectpublic boolean isTracking(java.lang.Object key, CMMsg msg)
Triggerer
isTracking
in interface Triggerer
key
- the arbitrary but unique key objectmsg
- the message that might be relevant.Triggerer.isCompleted(Object, CMMsg)
,
Triggerer.whichTracking(CMMsg)
,
Triggerer.whichCompleted(Object[], CMMsg)
public java.lang.Object[] whichTracking(CMMsg msg)
Triggerer
whichTracking
in interface Triggerer
msg
- the message that might be relevantTriggerer.isCompleted(Object, CMMsg)
,
Triggerer.isTracking(Object, CMMsg)
,
Triggerer.whichCompleted(Object[], CMMsg)
protected java.lang.String targName(Environmental target)
public boolean containsString(java.lang.String toSrchStr, java.lang.String srchForStr)
protected DefaultTriggerer.TrigState stepGetCompleted(MOB hostM, java.lang.Object key, CMMsg msg)
public boolean isCompleted(java.lang.Object key, CMMsg msg)
Triggerer
isCompleted
in interface Triggerer
key
- the arbitrary but unique key objectmsg
- the message which may cause a trigger to completeTriggerer.whichTracking(CMMsg)
,
Triggerer.isTracking(Object, CMMsg)
,
Triggerer.whichCompleted(Object[], CMMsg)
public java.lang.Object[] whichCompleted(java.lang.Object[] keys, CMMsg msg)
Triggerer
whichCompleted
in interface Triggerer
keys
- the arbitrary but unique keys to apply the message tomsg
- the message which may cause triggers to completeTriggerer.isCompleted(Object, CMMsg)
,
Triggerer.whichTracking(CMMsg)
,
Triggerer.isTracking(Object, CMMsg)
public Triad<MOB,java.lang.Object,java.util.List<java.lang.String>> getCompleted(MOB hostM, java.lang.Object[] keys, CMMsg msg)
Triggerer
getCompleted
in interface Triggerer
hostM
- normally the msg.source(), but who is the trigger hostkeys
- the arbitrary but unique keys to apply the message tomsg
- the message which may cause triggers to completeTriggerer.isCompleted(Object, CMMsg)
,
Triggerer.whichTracking(CMMsg)
,
Triggerer.isTracking(Object, CMMsg)
public java.lang.Object[] getInProgress(MOB mob)
Triggerer
getInProgress
in interface Triggerer
mob
- the mob who started somethingpublic boolean wasCompletedRecently(MOB mob, java.lang.Object key)
Triggerer
wasCompletedRecently
in interface Triggerer
mob
- the mob to checkkey
- the object key to checkpublic MOB[] whosDoneWaiting()
Triggerer
whosDoneWaiting
in interface Triggerer
public boolean hasTrigger(java.lang.Object key)
Triggerer
hasTrigger
in interface Triggerer
key
- the trigger keypublic java.util.Map<java.lang.String,java.util.List<Social>> getSocialSets()
Triggerer
getSocialSets
in interface Triggerer
public void addTriggerAssist(MOB assistingM, java.lang.Object key)
Triggerer
addTriggerAssist
in interface Triggerer
assistingM
- the mob being assisted, the main triggerer mobkey
- the key to the triggerpublic CMObject copyOf()
CMObject
public void initializeClass()
CMObject
initializeClass
in interface CMObject