Class: PFM::Quests

Inherits:
Object show all
Defined in:
scripts/01200 PFM/00100 Global Systems/01400 Quest.rb

Overview

The quest management

The main object is stored in $quests and $pokemon_party.quests

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeQuests

Create a new Quest management object

Instance Attribute Details

#active_questsHash<Integer => Hash>

The list of active_quests

Returns:

#failed_questsHash<Integer => Hash>

The list of failed_quests

Returns:

#finished_questsHash<Integer => Hash>

The list of finished_quests

Returns:

#signalHash<start: Array<Integer>, finish: Array<Integer>, failed: Array<Integer>>

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

Returns:

Instance Method Details

#__convert

Convert the quest object for PSDK Alpha 23.0

#add_item(item_id)

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

#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

#beat_pokemon(pokemon_id)

Inform the manager that a Pokemon has been beaten

Parameters:

  • pokemon_id (Integer)

    ID of the Pokemon in the database

#catch_pokemon(pokemon)

Inform the manager that a Pokemon has been captured

Parameters:

#check_pokemon_criterion(pkm, pokemon) ⇒ Boolean

Check the specific pokemon criterion in catch_pokemon

Parameters:

  • pkm (Hash)

    the criterions of the Pokemon

    The criterions are :

    nature: opt Integer # ID of the nature of the Pokemon
    type: opt Integer # One required type id
    min_level: opt Integer # The minimum level the Pokemon should have
    max_level: opt Integer # The maximum level the Pokemon should have
    level: opt Integer # The level the Pokemon must be
    
  • pokemon (PFM::Pokemon)

    the Pokemon that should be check with the criterions

Returns:

  • (Boolean)

    if the Pokemon pokemon check the criterions

#check_quest(quest_id)

Check if a quest is done or not

Parameters:

  • quest_id (Integer)

    ID of the quest in the database

#check_up_signal

Check the signals and display them

#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)

#egg_found Also known as: get_egg

Inform the manager an egg has been found

#failed?(quest_id) ⇒ Boolean

Is a quest failed ?

Parameters:

  • quest_id (Integer)

    ID of the quest in the database

Returns:

  • (Boolean)

#finished?(quest_id) ⇒ Boolean

Is a quest finished ?

Parameters:

  • quest_id (Integer)

    ID of the quest in the database

Returns:

  • (Boolean)

#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

#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:

#get_goal_type(quest_id, goal_index) ⇒ Symbol

Get the goal type

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:

  • (Symbol)

#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)

#hatch_egg

Inform the manager an egg has hatched

#see_pokemon(pokemon_id)

Inform the manager that a Pokemon has been seen

Parameters:

  • pokemon_id (Integer)

    ID of the Pokemon in the database

#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

#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

#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