Class: Char
- Inherits:
-
Object
- Object
- Char
- Defined in:
- lib/Olib/character/char.rb
Constant Summary collapse
- @@silvers =
0
- @@routines =
{}
Class Method Summary collapse
- .deplete_wealth(silvers) ⇒ Object
- .deposit(amt) ⇒ Object
- .deposit_all ⇒ Object
- .fwi_teleporter ⇒ Object
- .hide ⇒ Object
- .hiding_routine(procedure) ⇒ Object
- .left ⇒ Object
- .right ⇒ Object
-
.share ⇒ Object
naive share does not check if you’re actually in a group or not.
- .smart_wealth ⇒ Object
- .unhide ⇒ Object
- .visible? ⇒ Boolean
- .wealth ⇒ Object
- .withdraw(amount) ⇒ Object
Class Method Details
.deplete_wealth(silvers) ⇒ Object
77 78 79 |
# File 'lib/Olib/character/char.rb', line 77 def Char.deplete_wealth(silvers) @@silvers = @@silvers - silvers end |
.deposit(amt) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/Olib/character/char.rb', line 58 def Char.deposit(amt) wealth if wealth >= amt Go2.bank fput "unhide" if invisible? || hidden? fput "deposit #{amt}" end return self end |
.deposit_all ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/Olib/character/char.rb', line 50 def Char.deposit_all Go2.bank fput "unhide" if invisible? || hidden? fput "deposit all" @@silvers = 0 return self end |
.fwi_teleporter ⇒ Object
17 18 19 |
# File 'lib/Olib/character/char.rb', line 17 def Char.fwi_teleporter Vars.teleporter || Vars.mapdb_fwi_trinket end |
.hide ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/Olib/character/char.rb', line 5 def Char.hide while not hiding? waitrt? if @@routines[:hiding] @@routines[:hiding].call else fput 'hide' end end Char end |
.hiding_routine(procedure) ⇒ Object
25 26 27 28 |
# File 'lib/Olib/character/char.rb', line 25 def Char.hiding_routine(procedure) @@routines[:hiding] = procedure Char end |
.left ⇒ Object
30 31 32 |
# File 'lib/Olib/character/char.rb', line 30 def Char.left GameObj.left_hand.name == "Empty" ? nil : Olib::Item.new(GameObj.left_hand) end |
.right ⇒ Object
34 35 36 |
# File 'lib/Olib/character/char.rb', line 34 def Char.right GameObj.right_hand.name == "Empty" ? nil : Olib::Item.new(GameObj.right_hand) end |
.share ⇒ Object
naive share does not check if you’re actually in a group or not
70 71 72 73 74 75 |
# File 'lib/Olib/character/char.rb', line 70 def Char.share wealth fput "share #{@silvers}" wealth self end |
.smart_wealth ⇒ Object
81 82 83 84 |
# File 'lib/Olib/character/char.rb', line 81 def Char.smart_wealth return @@silvers if @@silvers Char.wealth end |
.unhide ⇒ Object
86 87 88 89 |
# File 'lib/Olib/character/char.rb', line 86 def Char.unhide fput 'unhide' if Spell[916].active? or hidden? self end |
.visible? ⇒ Boolean
21 22 23 |
# File 'lib/Olib/character/char.rb', line 21 def Char.visible? hiding? || invisible? end |
.wealth ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/Olib/character/char.rb', line 99 def Char.wealth fput "info" while(line=get) next if line =~ /^\s*Name\:|^\s*Gender\:|^\s*Normal \(Bonus\)|^\s*Strength \(STR\)\:|^\s*Constitution \(CON\)\:|^\s*Dexterity \(DEX\)\:|^\s*Agility \(AGI\)\:|^\s*Discipline \(DIS\)\:|^\s*Aura \(AUR\)\:|^\s*Logic \(LOG\)\:|^\s*Intuition \(INT\)\:|^\s*Wisdom \(WIS\)\:|^\s*Influence \(INF\)\:/ if line =~ /^\s*Mana\:\s+\-?[0-9]+\s+Silver\:\s+([0-9]+)/ @@silvers= $1.to_i break end sleep 0.1 end @@silvers end |
.withdraw(amount) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/Olib/character/char.rb', line 38 def Char.withdraw(amount) Go2.bank result = Olib.do "withdraw #{amount} silvers", /I'm sorry|hands you/ if result =~ /I'm sorry/ Go2.origin echo "Unable to withdraw the amount requested for this script to run from your bank account" exit end wealth return self end |