Class: PFM::Bag

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

Overview

InGame Bag management

The global Bag object is stored in $bag and PFM.game_state.bag

Author:

  • Nuri Yuri

Constant Summary collapse

SHORTCUT_AMOUNT =

Number of shortcut

4

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(game_state = PFM.game_state) ⇒ Bag

Create a new Bag

Parameters:

  • game_state (PFM::GameState) (defaults to: PFM.game_state) —

    variable responsive of containing the whole game state for easier access



56
57
# File 'docs/4_Systems_103_Bag.rb', line 56

def initialize(game_state = PFM.game_state)
end

Instance Attribute Details

#alpha_sorted ⇒ Boolean

Tell if the bag is alpha sorted

Returns:

  • (Boolean)


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

def alpha_sorted
  @alpha_sorted
end

#game_state ⇒ PFM::GameState

Get the game state responsive of the whole game state

Returns:



51
52
53
# File 'docs/4_Systems_103_Bag.rb', line 51

def game_state
  @game_state
end

#last_ball_used_db_symbol ⇒ Symbol

Set the last ball used

Returns:

  • (Symbol)


45
46
47
# File 'docs/4_Systems_103_Bag.rb', line 45

def last_ball_used_db_symbol
  @last_ball_used_db_symbol
end

#last_battle_item_db_symbol ⇒ Symbol

Set the last battle item

Returns:

  • (Symbol)


42
43
44
# File 'docs/4_Systems_103_Bag.rb', line 42

def last_battle_item_db_symbol
  @last_battle_item_db_symbol
end

#last_index ⇒ Integer

Last index in the socket

Returns:

  • (Integer)


36
37
38
# File 'docs/4_Systems_103_Bag.rb', line 36

def last_index
  @last_index
end

#last_socket ⇒ Integer

Last socket used in the bag

Returns:

  • (Integer)


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

def last_socket
  @last_socket
end

#locked ⇒ Boolean

If the bag is locked (and react as being empty)

Returns:

  • (Boolean)


39
40
41
# File 'docs/4_Systems_103_Bag.rb', line 39

def locked
  @locked
end

Instance Method Details

#add_item(db_symbol, nb = 1) Also known as: store_item

Add items in the bag and trigger the right quest objective

Parameters:

  • db_symbol (Symbol) —

    db_symbol of the item

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

    number of item to add



80
81
# File 'docs/4_Systems_103_Bag.rb', line 80

def add_item(db_symbol, nb = 1)
end

#contain_item?(db_symbol, quantity = 1) ⇒ Boolean Also known as: has_item?

If the bag contain a specific item

Parameters:

  • db_symbol (Symbol) —

    db_symbol of the item

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

    minimum quantity of the item (optional, default: 1)

Returns:

  • (Boolean) —

    whether the bag contains at least 'quantity' of the item.



65
66
# File 'docs/4_Systems_103_Bag.rb', line 65

def contain_item?(db_symbol, quantity = 1)
end

#convert_to_dot26

Convert bag to .26 format



59
60
# File 'docs/4_Systems_103_Bag.rb', line 59

def convert_to_dot26
end

#empty? ⇒ Boolean

Tell if the bag is empty

Returns:

  • (Boolean)


70
71
# File 'docs/4_Systems_103_Bag.rb', line 70

def empty?
end

#get_order(socket) ⇒ Array

Get the order of items in a socket

Parameters:

  • socket (Integer, Symbol) —

    ID of the socket

Returns:

  • (Array)


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

def get_order(socket)
end

#item_quantity(db_symbol) ⇒ Integer

The quantity of an item in the bag

Parameters:

  • db_symbol (Symbol) —

    db_symbol of the item

Returns:

  • (Integer)


75
76
# File 'docs/4_Systems_103_Bag.rb', line 75

def item_quantity(db_symbol)
end

#last_battle_item ⇒ Studio::Item

Get the last battle item

Returns:



112
113
# File 'docs/4_Systems_103_Bag.rb', line 112

def last_battle_item
end

#remove_item(db_symbol, nb = 999) Also known as: drop_item

Remove items from the bag

Parameters:

  • db_symbol (Symbol) —

    db_symbol of the item

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

    number of item to remove



86
87
# File 'docs/4_Systems_103_Bag.rb', line 86

def remove_item(db_symbol, nb = 999)
end

#reset_order(socket) ⇒ Array Also known as: sort_ids

Reset the order of items in a socket

Parameters:

  • socket (Integer) —

    ID of the socket

Returns:

  • (Array) —

    the new order



97
98
# File 'docs/4_Systems_103_Bag.rb', line 97

def reset_order(socket)
end

#shortcuts ⇒ Array<Symbol> Also known as: get_shortcuts

Get the shortcuts

Returns:

  • (Array<Symbol>)


107
108
# File 'docs/4_Systems_103_Bag.rb', line 107

def shortcuts
end

#sort_alpha(socket, reverse = false)

Sort the item of a socket by their names

Parameters:

  • socket (Integer) —

    ID of the socket

  • reverse (Boolean) (defaults to: false) —

    if we want to sort reverse



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

def sort_alpha(socket, reverse = false)
end