Class: Wowr::Classes::GuildBankLogEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/wowr/guild_bank.rb

Overview

Zero to 1 items <banklog dtab=“” money=“1200000” otab=“” player=“Quixsilver” rank=“0” ts=“1212595269000” type=“4”/> <banklog dtab=“” money=“0” otab=“0” player=“Quixsilver” rank=“0” ts=“1212527470000” type=“2”> <item count=“1” icon=“inv_potion_92” id=“12820” name=“Winterfall Firewater” qi=“1” subtype=“” type=“consumables”/> </banklog>

Constant Summary collapse

@@types =
{
  1 => 'Deposit Item',
  2 => 'Withdraw Item',
  3 => 'Move Item',
  4 => 'Deposit Money',
  5 => 'Withdraw Money',
  6 => 'Repair'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elem, bank = nil, api = nil) ⇒ GuildBankLogEntry

Returns a new instance of GuildBankLogEntry.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/wowr/guild_bank.rb', line 101

def initialize(elem, bank = nil, api = nil)
  @bank = bank
  
  @dtab      = elem[:dtab] == "" ? nil : elem[:dtab].to_i
  @otab      = elem[:otab] == "" ? nil : elem[:otab].to_i 
  @money   = Money.new(elem[:money].to_i)
  @player  = elem[:player]
  @rank_id = elem[:rank].to_i
  @ts      = elem[:ts].to_i # TODO: Check TS isn't overloading
  @type_id = elem[:type].to_i
  
  if (elem%'item')
    @item = GuildBankLogItem.new(elem%'item', api)
  end
end

Instance Attribute Details

#dtabObject (readonly)

Returns the value of attribute dtab.



90
91
92
# File 'lib/wowr/guild_bank.rb', line 90

def dtab
  @dtab
end

#itemObject (readonly)

Returns the value of attribute item.



90
91
92
# File 'lib/wowr/guild_bank.rb', line 90

def item
  @item
end

#moneyObject (readonly)

Returns the value of attribute money.



90
91
92
# File 'lib/wowr/guild_bank.rb', line 90

def money
  @money
end

#otabObject (readonly)

Returns the value of attribute otab.



90
91
92
# File 'lib/wowr/guild_bank.rb', line 90

def otab
  @otab
end

#playerObject (readonly)

Returns the value of attribute player.



90
91
92
# File 'lib/wowr/guild_bank.rb', line 90

def player
  @player
end

#rank_idObject (readonly)

Returns the value of attribute rank_id.



90
91
92
# File 'lib/wowr/guild_bank.rb', line 90

def rank_id
  @rank_id
end

#tsObject (readonly)

Returns the value of attribute ts.



90
91
92
# File 'lib/wowr/guild_bank.rb', line 90

def ts
  @ts
end

#type_idObject (readonly)

Returns the value of attribute type_id.



90
91
92
# File 'lib/wowr/guild_bank.rb', line 90

def type_id
  @type_id
end

Instance Method Details

#destinationObject



129
130
131
# File 'lib/wowr/guild_bank.rb', line 129

def destination
  @dtab.nil? ? nil : @bank.bags[@dtab]
end

#originObject



125
126
127
# File 'lib/wowr/guild_bank.rb', line 125

def origin
  @otab.nil? ? nil : @bank.bags[@otab]
end

#rankObject



121
122
123
# File 'lib/wowr/guild_bank.rb', line 121

def rank
  @rank_id.nil? ? nil : @bank.ranks[@rank_id]
end

#timeObject



133
134
135
# File 'lib/wowr/guild_bank.rb', line 133

def time
  return Time.at(@ts / 1000)
end

#typeObject



117
118
119
# File 'lib/wowr/guild_bank.rb', line 117

def type
  return @@types[@type_id]
end