package noppes.npcs.api.handler.data;
import noppes.npcs.api.entity.IPlayer;
/**
* 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
*
* The method {@link #isAvailable(IPlayer)} evaluates all these criteria.
*/
public interface IAvailability {
/**
* 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.
*
*
* @param player the player for whom availability is being checked.
* @return true if all conditions are met; false otherwise.
*/
boolean isAvailable(IPlayer player);
/**
* Returns the daytime condition requirement as an ordinal value.
*
* The returned value corresponds to:
*
* - 0 – Always
* - 1 – Day
* - 2 – Night
*
*
* @return the ordinal value representing the required daytime condition.
*/
int getDaytime();
/**
* Sets the daytime condition requirement.
*
* The provided value is clamped between 0 and 2, corresponding to:
*
* - 0 – Always
* - 1 – Day
* - 2 – Night
*
*
* @param daytime the ordinal value for the daytime condition.
*/
void setDaytime(int daytime);
/**
* Returns the minimum player level required for the availability conditions.
*
* @return the minimum player level.
*/
int getMinPlayerLevel();
/**
* Sets the minimum player level required for the availability conditions.
*
* @param level the minimum player level.
*/
void setMinPlayerLevel(int level);
/**
* 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.
*
* @param index the dialog slot index (0–3).
* @return the dialog ID associated with the specified slot.
*/
int getDialog(int index);
/**
* 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)
*
*
* @param index the dialog slot index (0–3).
* @param id the dialog ID to set.
* @param type the availability type as an ordinal value.
*/
void setDialog(int index, int id, int type);
/**
* 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.
*
* @param index the dialog slot index (0–3).
*/
void removeDialog(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.
*
* @param index the quest slot index (0–3).
* @return the quest ID for the specified slot.
*/
int getQuest(int index);
/**
* 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.
*
* @param index the quest slot index (0–3).
* @param id the quest ID to set.
* @param type the availability type as an ordinal value.
*/
void setQuest(int index, int id, int type);
/**
* 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.
*
* @param index the quest slot index (0–3).
*/
void removeQuest(int index);
/**
* 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).
*
*
* @param slot the faction slot index (0 or 1).
* @param id the faction ID.
* @param type the faction availability type as an ordinal value.
* @param stance the required faction stance as an ordinal value.
*/
void setFaction(int slot, int id, int type, int stance);
/**
* 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.
*
* @param slot the faction slot index (0 or 1).
*/
void removeFaction(int slot);
}