aro 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/aos +8 -3
- data/bin/aro +5 -2
- data/checksums/aro-0.1.9.gem.sha512 +1 -0
- data/checksums/aro-0.2.0.gem.sha512 +1 -0
- data/db/migrate/1763374647_create_decks.rb +2 -2
- data/listen.rb +1 -1
- data/locale/en.aos.yml +5 -1
- data/locale/en.cards.yml +156 -156
- data/locale/en.cngelog.yml +1 -1
- data/locale/en.dom.yml +42 -0
- data/locale/en.usage.yml +15 -10
- data/locale/en.yml +12 -15
- data/sys/aos/aos.rb +249 -114
- data/sys/aos/db.rb +13 -6
- data/sys/aos/views/base.rb +72 -45
- data/sys/aos/views/dom.rb +1 -10
- data/sys/aos/views/games/game.rb +92 -0
- data/sys/aos/views/setup/settings.rb +3 -16
- data/sys/aos/you.rb +4 -0
- data/sys/aro/db.rb +12 -7
- data/sys/aro/mancy.rb +16 -9
- data/sys/aro/p.rb +2 -2
- data/sys/cli/config.rb +131 -44
- data/sys/cli/constants.rb +3 -3
- data/sys/cli/deck.rb +27 -13
- data/sys/cli/dom.rb +11 -4
- data/sys/dom/d.rb +24 -14
- data/sys/dom/dom.rb +41 -27
- data/sys/dom/p.rb +1 -1
- data/sys/models/deck.rb +25 -12
- data/sys/reiquire.rb +2 -0
- data/sys/shr/prompt.rb +4 -0
- data/sys/shr/t.rb +19 -9
- data/sys/shr/version.rb +2 -4
- metadata +5 -3
- data/sys/aos/views/games/deck.rb +0 -95
data/sys/dom/dom.rb
CHANGED
|
@@ -12,48 +12,47 @@ require_relative :"../aos/s".to_s
|
|
|
12
12
|
|
|
13
13
|
module Aro
|
|
14
14
|
class Dom
|
|
15
|
-
PS1 = Aro::Dom.name
|
|
15
|
+
PS1 = :">[#{Aro::Dom.name}]>: "
|
|
16
16
|
DOT = :"."
|
|
17
17
|
DOTT = :"#{DOT}#{DOT}"
|
|
18
18
|
ETHERGEIST = :ethergeist
|
|
19
19
|
ETHER_FILE = :".#{Aro::Dom::ETHERGEIST}"
|
|
20
20
|
|
|
21
|
-
# < root
|
|
21
|
+
# < root space
|
|
22
22
|
ARODOME = :arodome
|
|
23
23
|
|
|
24
|
-
# < user
|
|
24
|
+
# < user spaces
|
|
25
25
|
WELCOME = :welcome
|
|
26
26
|
GAMES = :games
|
|
27
27
|
KNOW = :know
|
|
28
28
|
SETUP = :setup
|
|
29
29
|
|
|
30
|
-
# > welcome
|
|
30
|
+
# > welcome spaces
|
|
31
31
|
WAITE = :waite
|
|
32
32
|
WINNER = :winner
|
|
33
33
|
|
|
34
|
-
# > game
|
|
34
|
+
# > game spaces
|
|
35
35
|
ABPPS = :abpps
|
|
36
36
|
HBPPS = :hbpps
|
|
37
37
|
SHPPS = :shpps
|
|
38
38
|
VIPPS = :vipps
|
|
39
39
|
|
|
40
|
-
# > know
|
|
40
|
+
# > know spaces
|
|
41
41
|
LIBRARY = :library
|
|
42
42
|
TEMPLE = :temple
|
|
43
43
|
# ...
|
|
44
44
|
|
|
45
|
-
# > setup
|
|
45
|
+
# > setup spaces
|
|
46
46
|
SETTINGS = :settings
|
|
47
47
|
# ...
|
|
48
48
|
|
|
49
49
|
def self.create(name)
|
|
50
50
|
if Dir.exist?(name) || File.exist?(name)
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
Aro::Dom::P.say(I18n.t("dom.errors.failed_directory_exists", name: name))
|
|
52
|
+
return
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
Aro::Dom::P.say("creating arodome named #{name}")
|
|
55
|
+
Aro::Dom::P.say(I18n.t("dom.messages.creating_arodome", name: name))
|
|
57
56
|
FileUtils.mkdir(name)
|
|
58
57
|
ether_file_path = "#{name}/#{Aro::Dom::ETHER_FILE}"
|
|
59
58
|
FileUtils.mkdir(ether_file_path)
|
|
@@ -61,16 +60,27 @@ module Aro
|
|
|
61
60
|
file.write(name)
|
|
62
61
|
end
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
Aro::Dom::P.say("#{name} arodome created. enter the following commands to begin.")
|
|
66
|
-
Aro::Dom::P.say("$ cd #{name}")
|
|
67
|
-
Aro::Dom::P.say("$ aro dom init")
|
|
63
|
+
Aro::Dom::P.say(I18n.t("dom.messages.arodome_created", name: name))
|
|
68
64
|
end
|
|
69
65
|
|
|
70
66
|
def self.in_arodom?
|
|
71
67
|
!Aro::Dom.ethergeist_path.nil?
|
|
72
68
|
end
|
|
73
69
|
|
|
70
|
+
def self.is_initialized?
|
|
71
|
+
return false if !Aro::Dom.in_arodom?
|
|
72
|
+
|
|
73
|
+
File.exist?(File.join(Aro::Dom::ethergeist_path, Aos::Db::SQL_FILE.to_s))
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def self.domain
|
|
77
|
+
"#{Aro::Dom}#{Aos::Os::A}#{Aro::Dom.ethergeist_name}"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def self.dom_root
|
|
81
|
+
Aro::Dom.in_arodom? ? File.dirname(Aro::Dom::ethergeist_path) : nil
|
|
82
|
+
end
|
|
83
|
+
|
|
74
84
|
def self.room_path(needle)
|
|
75
85
|
return nil if needle.nil?
|
|
76
86
|
needle = needle.to_s.strip
|
|
@@ -103,7 +113,7 @@ module Aro
|
|
|
103
113
|
search_path.any?{|step|
|
|
104
114
|
search_pwd = File.join(search_pwd, step)
|
|
105
115
|
ls = Dir.glob("#{search_pwd}/#{ETHER_FILE}", File::FNM_DOTMATCH)
|
|
106
|
-
|
|
116
|
+
|
|
107
117
|
path = ls.first if ls.any?
|
|
108
118
|
!path.nil?
|
|
109
119
|
}
|
|
@@ -111,25 +121,29 @@ module Aro
|
|
|
111
121
|
return path
|
|
112
122
|
end
|
|
113
123
|
|
|
114
|
-
def self.
|
|
115
|
-
|
|
124
|
+
def self.ethergeist_name
|
|
125
|
+
return nil unless Aro::Dom.in_arodom?
|
|
126
|
+
|
|
127
|
+
File.read(
|
|
128
|
+
File.join(
|
|
129
|
+
Aro::Dom.ethergeist_path, Aro::Mancy::NAME_FILE.to_s
|
|
130
|
+
)
|
|
131
|
+
)
|
|
116
132
|
end
|
|
117
133
|
|
|
118
134
|
def generate
|
|
119
135
|
return unless Aro::Dom.in_arodom?
|
|
120
136
|
|
|
121
137
|
# todo: add file permissions to Aro::Dom::ARODOME and all WINGS
|
|
122
|
-
|
|
123
|
-
Aro::Dom::P.say("generating wings...")
|
|
138
|
+
Aro::Dom::P.say(I18n.t("dom.messages.generating_wings"))
|
|
124
139
|
Aro::Dom::D::LAYOUT.values.each{|w| generate_wing w}
|
|
125
|
-
|
|
126
|
-
Aro::Dom::P.say("
|
|
140
|
+
Aos::Db::new
|
|
141
|
+
Aro::Dom::P.say(I18n.t("dom.messages.initialization_complete", name: Aro::Dom.name))
|
|
127
142
|
end
|
|
128
143
|
|
|
129
144
|
def generate_wing(wing)
|
|
130
145
|
return unless Aro::Dom::D::LAYOUT.values.include?(wing)
|
|
131
|
-
|
|
132
|
-
Aro::Dom::P.say("generating the #{wing[:name]} wing...")
|
|
146
|
+
Aro::Dom::P.say(I18n.t("dom.messages.generating_wing", wing: wing[:name].to_s))
|
|
133
147
|
FileUtils.mkdir(wing[:name].to_s)
|
|
134
148
|
|
|
135
149
|
wing[:rooms].each{|r| generate_room(wing, r)}
|
|
@@ -138,13 +152,13 @@ module Aro
|
|
|
138
152
|
def generate_room(wing, room)
|
|
139
153
|
return unless Aro::Dom::D::WINGS[wing[:name].upcase].values.include?(room)
|
|
140
154
|
|
|
141
|
-
Aro::Dom::P.say("
|
|
155
|
+
Aro::Dom::P.say(I18n.t("dom.messages.generating_room", room: room[:name].to_s))
|
|
142
156
|
|
|
143
157
|
room_path = File.join(wing[:name].to_s, room[:name].to_s)
|
|
144
158
|
FileUtils.mkdir(room_path)
|
|
145
159
|
|
|
146
160
|
if wing[:name] == Aro::Dom::GAMES
|
|
147
|
-
File.open(File.join(room_path, Aro::Mancy::NAME_FILE.to_s), "w
|
|
161
|
+
File.open(File.join(room_path, Aro::Mancy::NAME_FILE.to_s), "w") do |f|
|
|
148
162
|
f.write(room[:name])
|
|
149
163
|
end
|
|
150
164
|
end
|
|
@@ -157,5 +171,5 @@ module Aro
|
|
|
157
171
|
)
|
|
158
172
|
)
|
|
159
173
|
end
|
|
160
|
-
end
|
|
174
|
+
end
|
|
161
175
|
end # aroadhome
|
data/sys/dom/p.rb
CHANGED
data/sys/models/deck.rb
CHANGED
|
@@ -42,9 +42,9 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
42
42
|
|
|
43
43
|
def generate_log
|
|
44
44
|
prev_cards = Base64::decode64(logs.last.card_data) if logs.any?
|
|
45
|
-
if prev_cards.present? && prev_cards != cards || prev_cards.nil?
|
|
45
|
+
if (prev_cards.present? && prev_cards != cards) || (prev_cards.nil? || prev_cards.empty?)
|
|
46
46
|
logs.create(
|
|
47
|
-
card_data: Base64::encode64(cards),
|
|
47
|
+
card_data: Base64::encode64(cards || ""),
|
|
48
48
|
drawn_data: Base64::encode64(drawn || "")
|
|
49
49
|
)
|
|
50
50
|
end
|
|
@@ -56,7 +56,8 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
56
56
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
choose_deck_text = Aro::Mancy::PS1.to_s + I18n.t("cli.messages.choose_deck")
|
|
60
|
+
selection = Aro::P.p.select(choose_deck_text) do |menu|
|
|
60
61
|
Aro::Deck.all.each{|d|
|
|
61
62
|
if d.id == Aro::Deck.current_deck&.id
|
|
62
63
|
menu.default d.id
|
|
@@ -106,9 +107,9 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
106
107
|
# for now tests just expect text output
|
|
107
108
|
return h_logs if CLI::Config.is_test?
|
|
108
109
|
|
|
109
|
-
Aro::
|
|
110
|
+
Aro::D.say(I18n.t("cli.messages.showing", name: name, count: count_n, order: order_o))
|
|
110
111
|
|
|
111
|
-
Aos::Vi::
|
|
112
|
+
Aos::Vi::Game.show_game({
|
|
112
113
|
deck: self,
|
|
113
114
|
h_logs: h_logs,
|
|
114
115
|
count_n: count_n,
|
|
@@ -119,15 +120,23 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
119
120
|
def explore
|
|
120
121
|
# allows user to browse each card in the current deck.
|
|
121
122
|
answer = Aro::P.p.select(
|
|
122
|
-
I18n.t("cli.messages.choose_card"),
|
|
123
|
+
Aro::Mancy::PS1.to_s + I18n.t("cli.messages.choose_card"),
|
|
123
124
|
# formatted for tty-prompt gem
|
|
124
125
|
cards.split(Aro::Deck::CARD_DELIM.to_s).map{|c| [I18n.t("cards.#{Aro::Deck.card_strip(c)}.name"), c]}.to_h,
|
|
125
|
-
per_page: Aro::Mancy::
|
|
126
|
+
per_page: CLI::Config.display_config[:HEIGHT] - Aro::Mancy::S,
|
|
126
127
|
cycle: true,
|
|
127
128
|
default: Aro::Mancy::S
|
|
128
129
|
)
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
# {name: "four of swords", tag_list: ["lord of rest from strife", "libra", "jupiter", "introspection", "recuperation", "regain strength", "rest", "solitude", "stability"], reversed_tag_list: ["lord of rest from strife", "libra", "jupiter", "burnt out", "inundated", "need a break", "overwhelmed"], summary: "", reversed_summary: ""}
|
|
131
|
+
definition = I18n.t("cards.#{Aro::Deck.card_strip(answer)}")
|
|
132
|
+
indent = Aro::Mancy::N
|
|
133
|
+
Aro::P.say(definition[:name])
|
|
134
|
+
Aro::P.say(definition[:summary])
|
|
135
|
+
Aro::P.say("tags:")
|
|
136
|
+
definition[:tag_list].sort.each{|tl| Aro::P.say("".rjust(indent) + tl)}
|
|
137
|
+
Aro::P.say(definition[:reversed_summary])
|
|
138
|
+
Aro::P.say("reverse tags:")
|
|
139
|
+
definition[:reversed_tag_list].sort.each{|tl| Aro::P.say("".rjust(indent) + tl)}
|
|
131
140
|
end
|
|
132
141
|
|
|
133
142
|
def shuffle
|
|
@@ -146,7 +155,7 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
146
155
|
# the deck. this will preserve all card orientations.
|
|
147
156
|
cards_arr = cards.split(Aro::Deck::CARD_DELIM.to_s) || []
|
|
148
157
|
drawn_arr = drawn&.split(Aro::Deck::CARD_DELIM.to_s) || []
|
|
149
|
-
|
|
158
|
+
|
|
150
159
|
# append each drawn card to cards
|
|
151
160
|
drawn_arr.each{|dc| cards_arr << dc }
|
|
152
161
|
|
|
@@ -154,7 +163,7 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
154
163
|
update(drawn: "", cards: cards_arr.join(Aro::Deck::CARD_DELIM.to_s))
|
|
155
164
|
end
|
|
156
165
|
|
|
157
|
-
def draw(is_dt_dimension: true, z_max: 7, z: 1)
|
|
166
|
+
def draw(is_dt_dimension: true, z_max: 7, z: 1)
|
|
158
167
|
# the true card
|
|
159
168
|
abs_dev_tarot = nil
|
|
160
169
|
|
|
@@ -168,6 +177,10 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
168
177
|
# get drawn
|
|
169
178
|
drawn_arr = drawn&.split(Aro::Deck::CARD_DELIM.to_s) || []
|
|
170
179
|
|
|
180
|
+
if cards_arr.empty?
|
|
181
|
+
Aro::P.say("there are no cards left to draw.")
|
|
182
|
+
return
|
|
183
|
+
end
|
|
171
184
|
sleeps = 0
|
|
172
185
|
sleeps_max = z_max
|
|
173
186
|
|
|
@@ -175,7 +188,7 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
175
188
|
while sleeps <= sleeps_max && dev_tarot.nil? do
|
|
176
189
|
# use fallback randomness if /dev/tarot unavailable
|
|
177
190
|
if !is_dt_dimension || !File.exist?(Aro::T::DEV_TAROT_FILE.to_s)
|
|
178
|
-
dev_tarot = Aro::T.summon_ruby_facot
|
|
191
|
+
dev_tarot = Aro::T.summon_ruby_facot.split("")
|
|
179
192
|
else
|
|
180
193
|
# preferred randomness
|
|
181
194
|
read_value = Aro::T.read_dev_tarot&.strip&.split("")
|
data/sys/reiquire.rb
CHANGED
|
@@ -13,7 +13,9 @@ require :active_record.to_s
|
|
|
13
13
|
require :"active_record/schema_dumper".to_s
|
|
14
14
|
require :base64.to_s
|
|
15
15
|
require :fileutils.to_s
|
|
16
|
+
require :"io/console".to_s
|
|
16
17
|
require :i18n.to_s
|
|
18
|
+
require :readline.to_s
|
|
17
19
|
require :"tty-prompt".to_s
|
|
18
20
|
require :yaml.to_s
|
|
19
21
|
|
data/sys/shr/prompt.rb
CHANGED
data/sys/shr/t.rb
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
module Aro
|
|
12
12
|
module T
|
|
13
13
|
DEV_TAROT_FILE = :"/dev/tarot"
|
|
14
|
-
|
|
14
|
+
DEV_TAROT = :"Dev::Tarot".to_s
|
|
15
15
|
RUBY_FACOT = :"Ruby::Facot".to_s
|
|
16
16
|
|
|
17
17
|
def self.is_dev_tarot?
|
|
@@ -21,19 +21,29 @@ module Aro
|
|
|
21
21
|
# read dev_tarot
|
|
22
22
|
def self.read_dev_tarot
|
|
23
23
|
dt = nil
|
|
24
|
-
|
|
24
|
+
if Aro::T.is_dev_tarot?
|
|
25
|
+
if File.exist?(Aro::T::DEV_TAROT_FILE.to_s)
|
|
26
|
+
File.open(Aro::T::DEV_TAROT_FILE.to_s, "r"){|dtf| dt = dtf.read(Aro::Mancy::N)}
|
|
27
|
+
# VERY IMPORTANT!
|
|
28
|
+
Aro::V.say(I18n.t("cli.very_important", dev_tarot: dt))
|
|
29
|
+
else
|
|
30
|
+
Aro::D.say("error: /dev/tarot not installed.")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
if dt.nil?
|
|
35
|
+
# fallback on ruby_facot
|
|
36
|
+
Aro::V.say("warning: summoning ruby_facot in #{__method__}")
|
|
37
|
+
dt = Aro::T.summon_ruby_facot
|
|
38
|
+
end
|
|
25
39
|
|
|
26
|
-
File.open(Aro::T::DEV_TAROT_FILE.to_s, "r"){|dtf| dt = dtf.read(Aro::Mancy::N)}
|
|
27
|
-
|
|
28
|
-
# VERY IMPORTANT!
|
|
29
|
-
Aro::D.say(I18n.t("cli.very_important", dev_tarot: dt))
|
|
30
40
|
return dt
|
|
31
41
|
end
|
|
32
42
|
|
|
33
43
|
# summon ruby_facot
|
|
34
|
-
def self.summon_ruby_facot
|
|
35
|
-
Aro::
|
|
36
|
-
ruby_facot =
|
|
44
|
+
def self.summon_ruby_facot
|
|
45
|
+
Aro::D.say(I18n.t("cli.messages.ruby_facot_random"))
|
|
46
|
+
ruby_facot = I18n.t("cards.index").map{|c| "+#{c}"}.sample.split("")
|
|
37
47
|
|
|
38
48
|
# get orientation
|
|
39
49
|
ruby_facot_str = ["+","-"].sample
|
data/sys/shr/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- i2097i
|
|
@@ -193,6 +193,8 @@ files:
|
|
|
193
193
|
- checksums/aro-0.1.6.gem.sha512
|
|
194
194
|
- checksums/aro-0.1.7.gem.sha512
|
|
195
195
|
- checksums/aro-0.1.8.gem.sha512
|
|
196
|
+
- checksums/aro-0.1.9.gem.sha512
|
|
197
|
+
- checksums/aro-0.2.0.gem.sha512
|
|
196
198
|
- db/migrate/1763374647_create_decks.rb
|
|
197
199
|
- db/migrate/1763432541_create_logs.rb
|
|
198
200
|
- db/migrate/1765148774_create_yous.rb
|
|
@@ -200,6 +202,7 @@ files:
|
|
|
200
202
|
- locale/en.aos.yml
|
|
201
203
|
- locale/en.cards.yml
|
|
202
204
|
- locale/en.cngelog.yml
|
|
205
|
+
- locale/en.dom.yml
|
|
203
206
|
- locale/en.usage.yml
|
|
204
207
|
- locale/en.yml
|
|
205
208
|
- sys/aos/aos.rb
|
|
@@ -209,7 +212,6 @@ files:
|
|
|
209
212
|
- sys/aos/views/dom.rb
|
|
210
213
|
- sys/aos/views/games.rb
|
|
211
214
|
- sys/aos/views/games/abpps.rb
|
|
212
|
-
- sys/aos/views/games/deck.rb
|
|
213
215
|
- sys/aos/views/games/game.rb
|
|
214
216
|
- sys/aos/views/games/hbpps.rb
|
|
215
217
|
- sys/aos/views/games/shpps.rb
|
|
@@ -269,5 +271,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
269
271
|
requirements: []
|
|
270
272
|
rubygems_version: 3.6.9
|
|
271
273
|
specification_version: 4
|
|
272
|
-
summary: this
|
|
274
|
+
summary: this version
|
|
273
275
|
test_files: []
|
data/sys/aos/views/games/deck.rb
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
|
|
3
|
-
views/games/deck.rb
|
|
4
|
-
|
|
5
|
-
the deck game view.
|
|
6
|
-
|
|
7
|
-
by i2097i
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
require_relative :"../base".to_s
|
|
12
|
-
require_relative :"../../../models/deck".to_s
|
|
13
|
-
|
|
14
|
-
module Aos
|
|
15
|
-
module Vi
|
|
16
|
-
class Deck < Aos::Vi::Base
|
|
17
|
-
|
|
18
|
-
PARAMS = [
|
|
19
|
-
:deck,
|
|
20
|
-
:h_logs,
|
|
21
|
-
:count_n,
|
|
22
|
-
:order_o,
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
def self.show(model)
|
|
26
|
-
self.debug_log(model)
|
|
27
|
-
mk = model.keys
|
|
28
|
-
dp = Aos::Vi::Deck::PARAMS
|
|
29
|
-
return nil unless (mk & dp).count == dp.count
|
|
30
|
-
return nil unless model.values.all?{|v| v != nil}
|
|
31
|
-
|
|
32
|
-
deck = model[:deck]
|
|
33
|
-
h_logs = model[:h_logs]
|
|
34
|
-
count_n = model[:count_n]
|
|
35
|
-
order_o = model[:order_o]
|
|
36
|
-
|
|
37
|
-
dc = CLI::Config.display_config
|
|
38
|
-
width = dc[:WIDTH] = viewport_width
|
|
39
|
-
divider = dc[:DIVIDER] * viewport_width
|
|
40
|
-
lines = []
|
|
41
|
-
lines << divider
|
|
42
|
-
lines << ""
|
|
43
|
-
lines << "#{deck.name.upcase.center(width)}"
|
|
44
|
-
lines << ""
|
|
45
|
-
h_logs.each_with_index{|l, i|
|
|
46
|
-
lines << divider
|
|
47
|
-
lines << l.created_at.strftime(CLI::Config::DATE_FORMAT).center(width)
|
|
48
|
-
lines << "#{order_o.to_sym == Aro::Log::ORDERING[:DESC] ? deck.logs.count - i : 1 + i} of #{deck.logs.count}".rjust(width)
|
|
49
|
-
lines << divider
|
|
50
|
-
lines << ""
|
|
51
|
-
lines << ""
|
|
52
|
-
lines += self.get_display_for_cards(
|
|
53
|
-
Base64::decode64(l.card_data).split(Aro::Deck::CARD_DELIM.to_s)
|
|
54
|
-
)
|
|
55
|
-
lines << divider
|
|
56
|
-
|
|
57
|
-
drawn_cards = Base64::decode64(l.drawn_data).split(Aro::Deck::CARD_DELIM.to_s)
|
|
58
|
-
|
|
59
|
-
if !drawn_cards.nil? && drawn_cards.any?
|
|
60
|
-
lines << I18n.t("cli.messages.history_drawn").center(width)
|
|
61
|
-
lines << divider
|
|
62
|
-
lines << ""
|
|
63
|
-
lines += self.get_display_for_cards(
|
|
64
|
-
drawn_cards
|
|
65
|
-
)
|
|
66
|
-
lines << ""
|
|
67
|
-
lines << divider
|
|
68
|
-
end
|
|
69
|
-
}
|
|
70
|
-
if count_n == Aro::Mancy::S
|
|
71
|
-
draw(lines)
|
|
72
|
-
else
|
|
73
|
-
Aro::P.less(lines.join("\n"))
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def self.get_display_for_cards(input = [])
|
|
78
|
-
columns = CLI::Config.display_config[:COLUMNS].to_i
|
|
79
|
-
lines = []
|
|
80
|
-
card_line = ""
|
|
81
|
-
input.each_with_index{|c, i|
|
|
82
|
-
s = (i + Aro::Mancy::S) % [Aro::Mancy::S, columns].max
|
|
83
|
-
card_line += c.ljust(columns)
|
|
84
|
-
if Aro::Mancy::O == s || i == input.count - Aro::Mancy::S
|
|
85
|
-
lines << card_line
|
|
86
|
-
card_line = ""
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
lines << ""
|
|
91
|
-
lines
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
end
|