Interface IAvailability
-
public interface IAvailability
Defines the conditions that determine if certain NPC interactions (dialogs, quests, and faction requirements) are available to a player.Availability conditions include:
- Daytime restrictions (Always, Day, or Night)
- Dialog conditions (based on whether a dialog has been read or not)
- Quest conditions (before, after, active, not active, acceptable, etc.)
- Faction requirements (faction ID, availability type and required stance)
- Minimum player level
isAvailable(IPlayer)
evaluates all these criteria.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getDaytime()
Returns the daytime condition requirement as an ordinal value.int
getDialog(int index)
Retrieves the dialog ID for the specified slot.int
getMinPlayerLevel()
Returns the minimum player level required for the availability conditions.int
getQuest(int index)
Retrieves the quest ID for the specified slot.boolean
isAvailable(IPlayer player)
Determines whether all availability conditions are met for the given player.void
removeDialog(int index)
Removes the dialog from the specified slot, resetting it to default values.void
removeFaction(int slot)
Removes the faction requirement from the specified slot, resetting it to default values.void
removeQuest(int index)
Removes the quest from the specified slot, resetting it to default values.void
setDaytime(int daytime)
Sets the daytime condition requirement.void
setDialog(int index, int id, int type)
Sets the dialog for the specified slot with the given dialog ID and availability type.void
setFaction(int slot, int id, int type, int stance)
Sets the faction requirement for the specified slot with the given parameters.void
setMinPlayerLevel(int level)
Sets the minimum player level required for the availability conditions.void
setQuest(int index, int id, int type)
Sets the quest for the specified slot with the given quest ID and availability type.
-
-
-
Method Detail
-
isAvailable
boolean isAvailable(IPlayer player)
Determines whether all availability conditions are met for the given player.Conditions checked include:
- Daytime requirement – if set to Day, the player must be in daytime; if Night, in nighttime.
- Dialog conditions – all dialog slots (0–3) must match their respective availability settings.
- Quest conditions – all quest slots (0–3) must satisfy their availability criteria.
- Faction conditions – each faction requirement (slot 0 and 1) must match the specified faction availability and stance.
- Minimum player level – the player's level must be at least the required minimum.
- Parameters:
player
- the player for whom availability is being checked.- Returns:
- true if all conditions are met; false otherwise.
-
getDaytime
int getDaytime()
Returns the daytime condition requirement as an ordinal value.The returned value corresponds to:
- 0 – Always
- 1 – Day
- 2 – Night
- Returns:
- the ordinal value representing the required daytime condition.
-
setDaytime
void setDaytime(int daytime)
Sets the daytime condition requirement.The provided value is clamped between 0 and 2, corresponding to:
- 0 – Always
- 1 – Day
- 2 – Night
- Parameters:
daytime
- the ordinal value for the daytime condition.
-
getMinPlayerLevel
int getMinPlayerLevel()
Returns the minimum player level required for the availability conditions.- Returns:
- the minimum player level.
-
setMinPlayerLevel
void setMinPlayerLevel(int level)
Sets the minimum player level required for the availability conditions.- Parameters:
level
- the minimum player level.
-
getDialog
int getDialog(int index)
Retrieves the dialog ID for the specified slot.Valid slot indices are 0 to 3. A dialog ID of -1 indicates no dialog is set.
- Parameters:
index
- the dialog slot index (0–3).- Returns:
- the dialog ID associated with the specified slot.
-
setDialog
void setDialog(int index, int id, int type)
Sets the dialog for the specified slot with the given dialog ID and availability type.The availability type (provided as an ordinal) determines when the dialog is available:
- 0 – Always
- 1 – Before (available before the dialog is read)
- 2 – After (available after the dialog is read)
- Parameters:
index
- the dialog slot index (0–3).id
- the dialog ID to set.type
- the availability type as an ordinal value.
-
removeDialog
void removeDialog(int index)
Removes the dialog from the specified slot, resetting it to default values.After removal, the dialog ID is set to -1 and its availability is reset to Always.
- Parameters:
index
- the dialog slot index (0–3).
-
getQuest
int getQuest(int index)
Retrieves the quest ID for the specified slot.Valid slot indices are 0 to 3. A quest ID of -1 indicates no quest is set.
- Parameters:
index
- the quest slot index (0–3).- Returns:
- the quest ID for the specified slot.
-
setQuest
void setQuest(int index, int id, int type)
Sets the quest for the specified slot with the given quest ID and availability type.The availability type for quests is provided as an ordinal and can represent various conditions such as Always, After, Before, Active, NotActive, Acceptable, or NotAcceptable.
- Parameters:
index
- the quest slot index (0–3).id
- the quest ID to set.type
- the availability type as an ordinal value.
-
removeQuest
void removeQuest(int index)
Removes the quest from the specified slot, resetting it to default values.After removal, the quest ID is set to -1 and its availability is reset to Always.
- Parameters:
index
- the quest slot index (0–3).
-
setFaction
void setFaction(int slot, int id, int type, int stance)
Sets the faction requirement for the specified slot with the given parameters.The parameters are:
slot
– the faction slot index (0 or 1).id
– the faction ID.type
– the faction availability type (clamped between 0 and 2).stance
– the required faction stance (clamped between 0 and 2).
- Parameters:
slot
- the faction slot index (0 or 1).id
- the faction ID.type
- the faction availability type as an ordinal value.stance
- the required faction stance as an ordinal value.
-
removeFaction
void removeFaction(int slot)
Removes the faction requirement from the specified slot, resetting it to default values.After removal, the faction ID is set to -1, the availability type is set to Always, and the faction stance is reset to Friendly.
- Parameters:
slot
- the faction slot index (0 or 1).
-
-