All Classes Namespaces Functions Variables Enumerations Enumerator Properties
DiaQ.DiaQuest Class Reference

A DiaQ Quest More...

Inherits plyCommon.plyMetaDataInterface.

Public Member Functions

override string ToString ()
 
void Awake ()
 called by DiaQuestManager's Awake at runtime More...
 
bool ConditionPerformed (string key)
 This will update the condition and note that it has been performed. The condition will be considered completed once it has been performed the target number of times DiaQuestCondition.targetValue. Will update DiaQuest.completed when quest is completed. Return false if condition key not found, quest not yet accepted by player or if player already completed the quest. More...
 
bool ConditionPerformed (string key, int val)
 This will update the condition performedTimes. The condition will be considered completed once it has been performed the target number of times DiaQuestCondition.targetValue. The value can be negative to decrease the performedTimes. More...
 
void SetCompleted (bool completed)
 Passing true will also update the condition progress as completed while false will reset all conditions' progress to 0 More...
 
void RunRewardGivers ()
 This will run through the rewards and execute any that makes use of DiaQuestReward.keyObject. If the execute fails then it is assumed that you want to make use of DiaQuestReward.keyString and will have to run through all rewards and check which of them are set (false == string.IsNullOrEmpty()) and then react according to your game's design. More...
 
string ParsedQuestText ()
 Return parsed text. The inline values will be inserted if any present in text. More...
 
void ResetQuestToAccepted ()
 This will set the quest as accepted but no progress in conditions and no rewards given More...
 
void ResetQuest ()
 This will set the quest as not accepted, no rewards given, no progress in conditions More...
 
Dictionary< string, plyMetaDataAllMetaData ()
 
List< plyMetaDataAllMetaDataList ()
 
plyMetaData GetMetaData (string name)
 Return reference to meta data object. Null if not found. More...
 
object GetMetaDataValue (string name)
 Return meta data value. Null if named meta data not found. More...
 
void SetMetaDataValue (string name, object val)
 Set meta data value. Will create the named meta data if not found and then set value. More...
 

Public Attributes

int id = -1
 Unique id of the quest More...
 
string name = ""
 Name of quest More...
 
string customIdent = ""
 Optional way to identify quest by More...
 
string text = ""
 Text associated with quest, for example a description of what the player must do. More...
 
List< DiaQuestConditionconditions = new List<DiaQuestCondition>()
 List of conditions that must be completed before the quest is considered completed. Do not update the conditions directly, except if you know what you are doing. In most cases you want to use the provided functions to update the conditions. More...
 
List< DiaQuestRewardrewards = new List<DiaQuestReward>()
 List of rewards for completing the quest. More...
 
plyMetaData[] metaData = new plyMetaData[0]
 Extra data that can be associated with the quest. Do not access at runtime, use provided functions. More...
 
bool _completed = false
 
bool _rewarded = false
 

Properties

bool accepted [get, set]
 Has this quest been accepted yet? setting this false will set completed = false and rewarded = false More...
 
bool completed [get, set]
 Has this quest been completed? setting this true will set accepted = true and will set all condition progress as completed. setting this false will set rewarded = false and will reset conditions's progress. More...
 
bool rewarded [get, set]
 Has the player receive the quest rewards yet or not? setting this true will set accepted = true and completed = true. Setting rewarded = true will not cause any game logic that gives the reward, to run. You handle that separately. More...
 
Dictionary< string, plyMetaDataruntimeMetaData [get, set]
 

Detailed Description

A DiaQ Quest

Member Function Documentation

void DiaQ.DiaQuest.Awake ( )

called by DiaQuestManager's Awake at runtime

bool DiaQ.DiaQuest.ConditionPerformed ( string  key)

This will update the condition and note that it has been performed. The condition will be considered completed once it has been performed the target number of times DiaQuestCondition.targetValue. Will update DiaQuest.completed when quest is completed. Return false if condition key not found, quest not yet accepted by player or if player already completed the quest.

bool DiaQ.DiaQuest.ConditionPerformed ( string  key,
int  val 
)

This will update the condition performedTimes. The condition will be considered completed once it has been performed the target number of times DiaQuestCondition.targetValue. The value can be negative to decrease the performedTimes.

plyMetaData DiaQ.DiaQuest.GetMetaData ( string  name)

Return reference to meta data object. Null if not found.

Implements plyCommon.plyMetaDataInterface.

object DiaQ.DiaQuest.GetMetaDataValue ( string  name)

Return meta data value. Null if named meta data not found.

Implements plyCommon.plyMetaDataInterface.

string DiaQ.DiaQuest.ParsedQuestText ( )

Return parsed text. The inline values will be inserted if any present in text.

void DiaQ.DiaQuest.ResetQuest ( )

This will set the quest as not accepted, no rewards given, no progress in conditions

void DiaQ.DiaQuest.ResetQuestToAccepted ( )

This will set the quest as accepted but no progress in conditions and no rewards given

void DiaQ.DiaQuest.RunRewardGivers ( )

This will run through the rewards and execute any that makes use of DiaQuestReward.keyObject. If the execute fails then it is assumed that you want to make use of DiaQuestReward.keyString and will have to run through all rewards and check which of them are set (false == string.IsNullOrEmpty()) and then react according to your game's design.

void DiaQ.DiaQuest.SetCompleted ( bool  completed)

Passing true will also update the condition progress as completed while false will reset all conditions' progress to 0

void DiaQ.DiaQuest.SetMetaDataValue ( string  name,
object  val 
)

Set meta data value. Will create the named meta data if not found and then set value.

Implements plyCommon.plyMetaDataInterface.

Member Data Documentation

List<DiaQuestCondition> DiaQ.DiaQuest.conditions = new List<DiaQuestCondition>()

List of conditions that must be completed before the quest is considered completed. Do not update the conditions directly, except if you know what you are doing. In most cases you want to use the provided functions to update the conditions.

string DiaQ.DiaQuest.customIdent = ""

Optional way to identify quest by

int DiaQ.DiaQuest.id = -1

Unique id of the quest

plyMetaData [] DiaQ.DiaQuest.metaData = new plyMetaData[0]

Extra data that can be associated with the quest. Do not access at runtime, use provided functions.

string DiaQ.DiaQuest.name = ""

Name of quest

List<DiaQuestReward> DiaQ.DiaQuest.rewards = new List<DiaQuestReward>()

List of rewards for completing the quest.

string DiaQ.DiaQuest.text = ""

Text associated with quest, for example a description of what the player must do.

Property Documentation

bool DiaQ.DiaQuest.accepted
getset

Has this quest been accepted yet? setting this false will set completed = false and rewarded = false

bool DiaQ.DiaQuest.completed
getset

Has this quest been completed? setting this true will set accepted = true and will set all condition progress as completed. setting this false will set rewarded = false and will reset conditions's progress.

bool DiaQ.DiaQuest.rewarded
getset

Has the player receive the quest rewards yet or not? setting this true will set accepted = true and completed = true. Setting rewarded = true will not cause any game logic that gives the reward, to run. You handle that separately.