Class: PFM::Quests

Inherits:
Object show all
Defined in:
docs/4_Systems_800_Quest.rb

Overview

The quest management

The main object is stored in $quests and PFM.game_state.quests

Defined Under Namespace

Classes: Quest

Constant Summary collapse

AUTO_CHECK_SIGNAL_ON_TEST =

Tell if the system should check the signal when we test finished?(id) or failed?(id)

true
AUTO_CHECK_SIGNAL_ON_ALL_OBJECTIVE_VALIDATED =

Tell if the system should check the signal when we check the quest termination

false

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Quests

Create a new Quest management object



23
24
# File 'docs/4_Systems_800_Quest.rb', line 23

def initialize
end

Instance Attribute Details

#active_quests ⇒ Hash{Integer => Quest}

The list of active_quests

Returns:

  • (Hash{Integer => Quest})


12
13
14
# File 'docs/4_Systems_800_Quest.rb', line 12

def active_quests
  @active_quests
end

#failed_quests ⇒ Hash{Integer => Quest}

The list of failed_quests

Returns:

  • (Hash{Integer => Quest})


18
19
20
# File 'docs/4_Systems_800_Quest.rb', line 18

def failed_quests
  @failed_quests
end

#finished_quests ⇒ Hash{Integer => Quest}

The list of finished_quests

Returns:

  • (Hash{Integer => Quest})


15
16
17
# File 'docs/4_Systems_800_Quest.rb', line 15

def finished_quests
  @finished_quests
end

#signal ⇒ Hash{start: Array<Integer>, finish: Array<Integer>, failed: Array<Integer>}

The signals that inform the game what quest started or has been finished

Returns:

  • (Hash{start: Array<Integer>, finish: Array<Integer>, failed: Array<Integer>})


21
22
23
# File 'docs/4_Systems_800_Quest.rb', line 21

def signal
  @signal
end

Instance Method Details

#active_quest(quest_id) ⇒ Quest

Return an active quest by its id

Parameters:

  • quest_id (Integer)

Returns:



33
34
# File 'docs/4_Systems_800_Quest.rb', line 33

def active_quest(quest_id)
end

#add_item(item_id, nb = 1)

Inform the manager that an item has been added to the bag of the Player

Parameters:

  • item_id (Integer) —

    ID of the item in the database

  • nb (Integer) (defaults to: 1) —

    number of item to add



84
85
# File 'docs/4_Systems_800_Quest.rb', line 84

def add_item(item_id, nb = 1)
end

#beat_npc(quest_id, npc_name_index) ⇒ Boolean

Inform the manager that a NPC has been beaten

Parameters:

  • quest_id (Integer) —

    the ID of the quest in the database

  • npc_name_index (Integer) —

    the index of the name of the NPC in the quest data

Returns:

  • (Boolean) —

    if the quest has been updated



73
74
# File 'docs/4_Systems_800_Quest.rb', line 73

def beat_npc(quest_id, npc_name_index)
end

#beat_pokemon(pokemon_symbol)

Inform the manager that a Pokemon has been beaten

Parameters:

  • pokemon_symbol (Symbol) —

    db_symbol of the Pokemon in the database



88
89
# File 'docs/4_Systems_800_Quest.rb', line 88

def beat_pokemon(pokemon_symbol)
end

#catch_pokemon(pokemon)

Inform the manager that a Pokemon has been captured

Parameters:



92
93
# File 'docs/4_Systems_800_Quest.rb', line 92

def catch_pokemon(pokemon)
end

#check_quest(quest_id)

Check if a quest is done or not

Parameters:

  • quest_id (Integer) —

    ID of the quest in the database



130
131
# File 'docs/4_Systems_800_Quest.rb', line 130

def check_quest(quest_id)
end

#check_up_signal

Checks if there are any quests that have started or finished. If there are, it displays the quest information and updates the quest status.



126
127
# File 'docs/4_Systems_800_Quest.rb', line 126

def check_up_signal
end

#complete_custom_objective(quest_id, objective_nb) ⇒ Boolean

Completes a custom objective for a given quest.

Parameters:

  • quest_id (Integer/Symbol) —

    The ID or db_symbol of the quest in the database.

  • objective_nb (Integer) —

    The number of the objective to complete.

Returns:

  • (Boolean) —

    True if the objective was completed successfully, false otherwise.



122
123
# File 'docs/4_Systems_800_Quest.rb', line 122

def complete_custom_objective(quest_id, objective_nb)
end

#earnings_got?(quest_id) ⇒ Boolean

Does the earning of a quest has been taken

Parameters:

  • quest_id (Integer) —

    ID of the quest in the database

Returns:

  • (Boolean)


149
150
# File 'docs/4_Systems_800_Quest.rb', line 149

def earnings_got?(quest_id)
end

#egg_found Also known as: get_egg

Inform the manager an egg has been found



99
100
# File 'docs/4_Systems_800_Quest.rb', line 99

def egg_found
end

#fail_quest(quest_id) ⇒ Boolean

Fail a quest Return a failed quest by its id

Parameters:

  • quest_id (Integer)

Returns:

  • (Boolean) —

    if the quest has been failed properly



44
45
# File 'docs/4_Systems_800_Quest.rb', line 44

def fail_quest(quest_id)
end

#failed?(quest_id) ⇒ Boolean

Is a quest failed ?

Parameters:

  • quest_id (Integer) —

    ID of the quest in the database

Returns:

  • (Boolean)


140
141
# File 'docs/4_Systems_800_Quest.rb', line 140

def failed?(quest_id)
end

#failed_quest(quest_id) ⇒ Quest?

Return a failed quest by its id

Parameters:

  • quest_id (Integer)

Returns:



49
50
# File 'docs/4_Systems_800_Quest.rb', line 49

def failed_quest(quest_id)
end

#finished?(quest_id) ⇒ Boolean

Is a quest finished ?

Parameters:

  • quest_id (Integer) —

    ID of the quest in the database

Returns:

  • (Boolean)


135
136
# File 'docs/4_Systems_800_Quest.rb', line 135

def finished?(quest_id)
end

#finished_quest(quest_id) ⇒ Quest

Return a finished quest by its id

Parameters:

  • quest_id (Integer)

Returns:



38
39
# File 'docs/4_Systems_800_Quest.rb', line 38

def finished_quest(quest_id)
end

#get_earnings(quest_id) ⇒ Boolean

Get the earnings of a quest

Parameters:

  • quest_id (Integer) —

    ID of the quest in the database

Returns:

  • (Boolean) —

    if the earning were givent to the player



145
146
# File 'docs/4_Systems_800_Quest.rb', line 145

def get_earnings(quest_id)
end

#get_goal_data_index(quest_id, goal_index) ⇒ Integer

Get the goal data index (if array like items / speak_to return the index of the goal in the array info from data/quest data)

Parameters:

  • quest_id (Integer) —

    the ID of the quest in the database

  • goal_index (Integer) —

    the index of the goal in the goal order

Returns:

  • (Integer)


67
68
# File 'docs/4_Systems_800_Quest.rb', line 67

def get_goal_data_index(quest_id, goal_index)
end

#goal_shown?(quest_id, goal_index) ⇒ Boolean

Tell if a goal is shown or not

Parameters:

  • quest_id (Integer) —

    the ID of the quest in the database

  • goal_index (Integer) —

    the index of the goal in the goal order

Returns:

  • (Boolean)


60
61
# File 'docs/4_Systems_800_Quest.rb', line 60

def goal_shown?(quest_id, goal_index)
end

#hatch_egg

Inform the manager an egg has hatched



103
104
# File 'docs/4_Systems_800_Quest.rb', line 103

def hatch_egg
end

#import_from_dot24

Import the quest data from dot 24 version of PSDK



152
153
# File 'docs/4_Systems_800_Quest.rb', line 152

def import_from_dot24
end

#new?(quest_id) ⇒ Boolean

Checks if a quest is new

Parameters:

  • quest_id (Integer/Symbol) —

    ID or db_symbol of the quest in the database

Returns:

  • (Boolean) —

    true if the quest has not been seen, false otherwise



114
115
# File 'docs/4_Systems_800_Quest.rb', line 114

def new?(quest_id)
end

#see_pokemon(pokemon_symbol)

Inform the manager that a Pokemon has been seen

Parameters:

  • pokemon_symbol (Symbol) —

    db_symbol of the Pokemon in the database



96
97
# File 'docs/4_Systems_800_Quest.rb', line 96

def see_pokemon(pokemon_symbol)
end

#seen_by_player(quest_id) ⇒ Boolean

Tell the quest it has been seen by the player

Parameters:

  • quest_id (Integer/Symbol) —

    ID or db_symbol of the quest in the database

Returns:

  • (Boolean) —

    if the quest wasn't already seen by the player



108
109
# File 'docs/4_Systems_800_Quest.rb', line 108

def seen_by_player(quest_id)
end

#show_goal(quest_id, goal_index)

Show a goal of a quest

Parameters:

  • quest_id (Integer) —

    the ID of the quest in the database

  • goal_index (Integer) —

    the index of the goal in the goal order



54
55
# File 'docs/4_Systems_800_Quest.rb', line 54

def show_goal(quest_id, goal_index)
end

#speak_to_npc(quest_id, npc_name_index) ⇒ Boolean

Inform the manager that a NPC has been spoken to

Parameters:

  • quest_id (Integer) —

    the ID of the quest in the database

  • npc_name_index (Integer) —

    the index of the name of the NPC in the quest data

Returns:

  • (Boolean) —

    if the quest has been updated



79
80
# File 'docs/4_Systems_800_Quest.rb', line 79

def speak_to_npc(quest_id, npc_name_index)
end

#start(quest_id) ⇒ Boolean

Start a new quest if possible

Parameters:

  • quest_id (Integer) —

    the ID of the quest in the database

Returns:

  • (Boolean) —

    if the quest started



28
29
# File 'docs/4_Systems_800_Quest.rb', line 28

def start(quest_id)
end

#update_quest_data_for_studio

Update teh quest data for Studio



155
156
# File 'docs/4_Systems_800_Quest.rb', line 155

def update_quest_data_for_studio
end