Class: PFM::Bag

Inherits:
Object show all
Defined in:
docs/01450_Systems_00103_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/01450_Systems_00103_Bag.rb', line 56

def initialize(game_state = PFM.game_state)
end

Instance Attribute Details

#alpha_sortedBoolean

Tell if the bag is alpha sorted

Returns:

  • (Boolean)


48
49
50
# File 'docs/01450_Systems_00103_Bag.rb', line 48

def alpha_sorted
  @alpha_sorted
end

#game_statePFM::GameState

Get the game state responsive of the whole game state

Returns:



51
52
53
# File 'docs/01450_Systems_00103_Bag.rb', line 51

def game_state
  @game_state
end

#last_ball_used_db_symbolSymbol

Set the last ball used

Returns:

  • (Symbol)


45
46
47
# File 'docs/01450_Systems_00103_Bag.rb', line 45

def last_ball_used_db_symbol
  @last_ball_used_db_symbol
end

#last_battle_item_db_symbolSymbol

Set the last battle item

Returns:

  • (Symbol)


42
43
44
# File 'docs/01450_Systems_00103_Bag.rb', line 42

def last_battle_item_db_symbol
  @last_battle_item_db_symbol
end

#last_indexInteger

Last index in the socket

Returns:

  • (Integer)


36
37
38
# File 'docs/01450_Systems_00103_Bag.rb', line 36

def last_index
  @last_index
end

#last_socketInteger

Last socket used in the bag

Returns:

  • (Integer)


33
34
35
# File 'docs/01450_Systems_00103_Bag.rb', line 33

def last_socket
  @last_socket
end

#lockedBoolean

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

Returns:

  • (Boolean)


39
40
41
# File 'docs/01450_Systems_00103_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



79
80
# File 'docs/01450_Systems_00103_Bag.rb', line 79

def add_item(db_symbol, nb = 1)
end

#contain_item?(db_symbol) ⇒ Boolean Also known as: has_item?

If the bag contain a specific item

Parameters:

  • db_symbol (Symbol)

    db_symbol of the item

Returns:

  • (Boolean)


64
65
# File 'docs/01450_Systems_00103_Bag.rb', line 64

def contain_item?(db_symbol)
end

#convert_to_dot26

Convert bag to .26 format



59
60
# File 'docs/01450_Systems_00103_Bag.rb', line 59

def convert_to_dot26
end

#empty?Boolean

Tell if the bag is empty

Returns:

  • (Boolean)


69
70
# File 'docs/01450_Systems_00103_Bag.rb', line 69

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)


91
92
# File 'docs/01450_Systems_00103_Bag.rb', line 91

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)


74
75
# File 'docs/01450_Systems_00103_Bag.rb', line 74

def item_quantity(db_symbol)
end

#last_battle_itemStudio::Item

Get the last battle item

Returns:



111
112
# File 'docs/01450_Systems_00103_Bag.rb', line 111

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



85
86
# File 'docs/01450_Systems_00103_Bag.rb', line 85

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



96
97
# File 'docs/01450_Systems_00103_Bag.rb', line 96

def reset_order(socket)
end

#shortcutsArray<Symbol> Also known as: get_shortcuts

Get the shortcuts

Returns:

  • (Array<Symbol>)


106
107
# File 'docs/01450_Systems_00103_Bag.rb', line 106

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



102
103
# File 'docs/01450_Systems_00103_Bag.rb', line 102

def sort_alpha(socket, reverse = false)
end