aro 0.2.1 → 0.2.2
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/README.md +1 -1
- data/bin/aro +3 -3
- data/checksums/aro-0.2.1.gem.sha512 +1 -0
- data/checksums/aro-0.2.2.gem.sha512 +1 -0
- data/locale/en.amg.yml +44 -0
- data/locale/en.aos.yml +4 -38
- data/locale/en.data.yml +30 -0
- data/locale/en.dom.yml +8 -6
- data/locale/en.usage.yml +20 -20
- data/locale/en.yml +16 -12
- data/sys/aos/amg.rb +58 -56
- data/sys/aos/aos.rb +82 -49
- data/sys/aos/data.rb +117 -0
- data/sys/aos/db/migrate/1765148774_create_yous.rb +1 -0
- data/sys/aos/db/migrate/{1765762724_create_libs.rb → 1765762724_create_ilibs.rb} +5 -5
- data/sys/aos/db/migrate/1765907766_create_ilogs.rb +18 -0
- data/sys/aos/db.rb +37 -17
- data/sys/{shr/lib/lib.rb → aos/models/ilib.rb} +9 -6
- data/sys/aos/models/ilog.rb +27 -0
- data/sys/aos/models/you.rb +50 -0
- data/sys/aos/vws/base.rb +9 -58
- data/sys/aos/vws/dom.rb +0 -1
- data/sys/aos/vws/games/game.rb +10 -10
- data/sys/aos/vws/know/{temple.rb → body.rb} +3 -3
- data/sys/aos/vws/know/{library.rb → mind.rb} +3 -3
- data/sys/aos/vws/know/spirit.rb +19 -0
- data/sys/aos/vws/{setup → root}/amg.rb +1 -2
- data/sys/aos/vws/{setup → root}/config.rb +1 -1
- data/sys/aos/vws/root/data.rb +21 -0
- data/sys/aos/vws/{setup.rb → root.rb} +3 -3
- data/sys/aos/vws/welcome/waite.rb +1 -0
- data/sys/aos/vws/welcome.rb +11 -0
- data/sys/aro/db/migrate/{1763374647_create_decks.rb → 1763374647_create_tecks.rb} +5 -5
- data/sys/aro/db/migrate/1763432541_create_tlogs.rb +20 -0
- data/sys/aro/db.rb +11 -11
- data/sys/aro/mancy.rb +4 -4
- data/sys/{models/deck.rb → aro/models/teck.rb} +51 -52
- data/sys/aro/models/tlog.rb +20 -0
- data/sys/cli/constants.rb +1 -1
- data/sys/cli/dom.rb +1 -1
- data/sys/cli/{deck.rb → teck.rb} +15 -15
- data/sys/cli.rb +4 -3
- data/sys/dom/config.rb +196 -143
- data/sys/dom/d.rb +32 -19
- data/sys/dom/dom.rb +22 -13
- data/sys/reiquire.rb +6 -7
- data/sys/shr/prompt.rb +0 -4
- data/sys/shr/version.rb +1 -1
- metadata +28 -20
- data/locale/en.cngelog.yml +0 -5
- data/sys/aos/you.rb +0 -21
- data/sys/aro/db/migrate/1763432541_create_logs.rb +0 -20
- data/sys/models/log.rb +0 -20
- /data/sys/shr/{lib → ilib}/crs/CMakeLists.txt +0 -0
- /data/sys/shr/{lib → ilib}/crs/compile.sh +0 -0
- /data/sys/shr/{lib → ilib}/crs/crs.c +0 -0
- /data/sys/shr/{lib → ilib}/crs/crs.o +0 -0
- /data/sys/shr/{lib → ilib}/crs/libcrs.so +0 -0
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
teck.rb
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
teck object.
|
|
6
6
|
|
|
7
7
|
by i2097i
|
|
8
8
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
require :base64.to_s
|
|
12
|
-
require_relative :"../shr/t".to_s
|
|
13
12
|
|
|
14
|
-
class Aro::
|
|
15
|
-
has_many :
|
|
13
|
+
class Aro::Teck < ActiveRecord::Base
|
|
14
|
+
has_many :tlogs
|
|
16
15
|
|
|
17
|
-
DECK_FILE = :".
|
|
16
|
+
DECK_FILE = :".teck"
|
|
18
17
|
CARD_DELIM = :","
|
|
19
18
|
|
|
20
19
|
before_create :populate_cards
|
|
@@ -22,24 +21,24 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
22
21
|
|
|
23
22
|
def self.make(new_name)
|
|
24
23
|
return nil unless Aro::Mancy.is_initialized?
|
|
25
|
-
Aro::Db.
|
|
26
|
-
|
|
27
|
-
Aro::
|
|
28
|
-
|
|
24
|
+
Aro::Db.load
|
|
25
|
+
new_teck = Aro::Teck.create(name: new_name)
|
|
26
|
+
Aro::Teck.select_teck(new_teck) if Aro::Teck.current_teck.nil?
|
|
27
|
+
new_teck
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
def self.fresh_cards
|
|
32
|
-
I18n.t("cards.index").map{|c| "+#{c}"}.join(Aro::
|
|
31
|
+
I18n.t("cards.index").map{|c| "+#{c}"}.join(Aro::Teck::CARD_DELIM.to_s)
|
|
33
32
|
end
|
|
34
33
|
|
|
35
34
|
def populate_cards
|
|
36
|
-
self.cards = Aro::
|
|
35
|
+
self.cards = Aro::Teck.fresh_cards
|
|
37
36
|
end
|
|
38
37
|
|
|
39
38
|
def generate_log
|
|
40
|
-
prev_cards = Base64::decode64(
|
|
39
|
+
prev_cards = Base64::decode64(tlogs.last.card_data) if tlogs.any?
|
|
41
40
|
if (prev_cards.present? && prev_cards != cards) || (prev_cards.nil? || prev_cards.empty?)
|
|
42
|
-
|
|
41
|
+
tlogs.create(
|
|
43
42
|
card_data: Base64::encode64(cards || ""),
|
|
44
43
|
drawn_data: Base64::encode64(drawn || "")
|
|
45
44
|
)
|
|
@@ -47,28 +46,28 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
47
46
|
end
|
|
48
47
|
|
|
49
48
|
def self.display_selection_menu
|
|
50
|
-
unless Aro::
|
|
51
|
-
Aro::P.say(I18n.t("cli.messages.
|
|
49
|
+
unless Aro::Teck.any?
|
|
50
|
+
Aro::P.say(I18n.t("cli.messages.no_tecks"))
|
|
52
51
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
53
52
|
end
|
|
54
|
-
c_d = Aro::
|
|
55
|
-
Aro::
|
|
53
|
+
c_d = Aro::Teck.current_teck
|
|
54
|
+
Aro::Teck.all.each do |d|
|
|
56
55
|
Aro::P.say("#{d.id == c_d.id ? :*.to_s : " "}#{d.id}): #{d.name}")
|
|
57
56
|
end
|
|
58
57
|
end
|
|
59
58
|
|
|
60
|
-
def self.
|
|
61
|
-
return unless
|
|
62
|
-
Aro::P.say(I18n.t("cli.messages.
|
|
63
|
-
File.open(Aro::
|
|
64
|
-
file.write(
|
|
59
|
+
def self.select_teck(teck)
|
|
60
|
+
return unless teck.present?
|
|
61
|
+
Aro::P.say(I18n.t("cli.messages.teck_selected", name: teck.name, room: Aro::Mancy::aro_mancy_name))
|
|
62
|
+
File.open(Aro::Teck::DECK_FILE.to_s, "w") do |file|
|
|
63
|
+
file.write(teck.id)
|
|
65
64
|
end
|
|
66
65
|
end
|
|
67
66
|
|
|
68
|
-
def self.
|
|
67
|
+
def self.current_teck
|
|
69
68
|
if File.exist?(DECK_FILE.to_s)
|
|
70
|
-
|
|
71
|
-
return Aro::
|
|
69
|
+
current_teck_id = File.read(DECK_FILE.to_s)
|
|
70
|
+
return Aro::Teck.find_by(id: current_teck_id)
|
|
72
71
|
end
|
|
73
72
|
end
|
|
74
73
|
|
|
@@ -76,54 +75,54 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
76
75
|
card.gsub(/[+-]/, "").strip
|
|
77
76
|
end
|
|
78
77
|
|
|
79
|
-
def show(count_n: Aro::Mancy::S, order_o: Aro::
|
|
78
|
+
def show(count_n: Aro::Mancy::S, order_o: Aro::Tlog::ORDERING[:DESC])
|
|
80
79
|
unless count_n.kind_of?(Numeric) && count_n.to_i > Aro::Mancy::O
|
|
81
80
|
if count_n&.to_s&.to_sym == Aro::Mancy::ALL
|
|
82
|
-
count_n =
|
|
81
|
+
count_n = tlogs.count
|
|
83
82
|
else
|
|
84
83
|
count_n = Aro::Mancy::S
|
|
85
84
|
end
|
|
86
85
|
end
|
|
87
|
-
count_n = [[Aro::Mancy::S, count_n.to_i].max,
|
|
86
|
+
count_n = [[Aro::Mancy::S, count_n.to_i].max, tlogs.count].min
|
|
88
87
|
Aro::V.say("count_n: #{count_n}")
|
|
89
88
|
Aro::V.say("order_o: #{order_o}")
|
|
90
89
|
|
|
91
|
-
unless Aro::
|
|
90
|
+
unless Aro::Tlog::ORDERING.values.include?(order_o)
|
|
92
91
|
Aro::P.say(I18n.t("cli.warnings.invalid_order"))
|
|
93
|
-
order_o = Aro::
|
|
92
|
+
order_o = Aro::Tlog::ORDERING[:DESC]
|
|
94
93
|
end
|
|
95
94
|
|
|
96
95
|
# perform query
|
|
97
|
-
|
|
96
|
+
tlog_records = tlogs.order(created_at: order_o).first(count_n)
|
|
98
97
|
|
|
99
98
|
# todo: this is doing more work than it needs to. needs debugging.
|
|
100
|
-
# Aro::V.say("
|
|
99
|
+
# Aro::V.say("tlog_records.count: #{tlog_records.count}")
|
|
101
100
|
|
|
102
101
|
# for now tests just expect text output
|
|
103
|
-
return
|
|
102
|
+
return tlog_records if Aro::Config.is_test?
|
|
104
103
|
|
|
105
104
|
Aro::D.say(I18n.t("cli.messages.showing", name: name, count: count_n, order: order_o))
|
|
106
105
|
|
|
107
106
|
Aos::Vw::Game.show_game({
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
teck: self,
|
|
108
|
+
tlog_records: tlog_records,
|
|
110
109
|
count_n: count_n,
|
|
111
110
|
order_o: order_o
|
|
112
111
|
})
|
|
113
112
|
end
|
|
114
113
|
|
|
115
114
|
def explore
|
|
116
|
-
# allows user to browse each card in the current
|
|
115
|
+
# allows user to browse each card in the current teck.
|
|
117
116
|
answer = Aro::P.p.select(
|
|
118
117
|
Aro::Mancy::PS1.to_s + I18n.t("cli.messages.choose_card"),
|
|
119
118
|
# formatted for tty-prompt gem
|
|
120
|
-
cards.split(Aro::
|
|
119
|
+
cards.split(Aro::Teck::CARD_DELIM.to_s).map{|c| [I18n.t("cards.#{Aro::Teck.card_strip(c)}.name"), c]}.to_h,
|
|
121
120
|
per_page: Aro::Config.display_configuration[:HEIGHT] - Aro::Mancy::S,
|
|
122
121
|
cycle: true,
|
|
123
122
|
default: Aro::Mancy::S
|
|
124
123
|
)
|
|
125
124
|
# {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: ""}
|
|
126
|
-
definition = I18n.t("cards.#{Aro::
|
|
125
|
+
definition = I18n.t("cards.#{Aro::Teck.card_strip(answer)}")
|
|
127
126
|
indent = Aro::Mancy::N
|
|
128
127
|
Aro::P.say(definition[:name])
|
|
129
128
|
Aro::P.say(definition[:summary])
|
|
@@ -135,27 +134,27 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
135
134
|
end
|
|
136
135
|
|
|
137
136
|
def shuffle
|
|
138
|
-
# shuffles the current
|
|
139
|
-
update(cards: cards.split(Aro::
|
|
137
|
+
# shuffles the current teck and generates a log record.
|
|
138
|
+
update(cards: cards.split(Aro::Teck::CARD_DELIM.to_s).shuffle.join(Aro::Teck::CARD_DELIM.to_s))
|
|
140
139
|
end
|
|
141
140
|
|
|
142
141
|
def reset
|
|
143
|
-
# completely reset the
|
|
142
|
+
# completely reset the teck. replace all drawn and reset order.
|
|
144
143
|
# all orientations will be set to upright.
|
|
145
|
-
update(cards: Aro::
|
|
144
|
+
update(cards: Aro::Teck.fresh_cards, drawn: "")
|
|
146
145
|
end
|
|
147
146
|
|
|
148
147
|
def replace
|
|
149
148
|
# replaces all drawn cards FIFO and puts them on the bottom of
|
|
150
|
-
# the
|
|
151
|
-
cards_arr = cards.split(Aro::
|
|
152
|
-
drawn_arr = drawn&.split(Aro::
|
|
149
|
+
# the teck. this will preserve all card orientations.
|
|
150
|
+
cards_arr = cards.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
151
|
+
drawn_arr = drawn&.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
153
152
|
|
|
154
153
|
# append each drawn card to cards
|
|
155
154
|
drawn_arr.each{|dc| cards_arr << dc }
|
|
156
155
|
|
|
157
156
|
# clear drawn
|
|
158
|
-
update(drawn: "", cards: cards_arr.join(Aro::
|
|
157
|
+
update(drawn: "", cards: cards_arr.join(Aro::Teck::CARD_DELIM.to_s))
|
|
159
158
|
end
|
|
160
159
|
|
|
161
160
|
def draw(is_dt_dimension: true, z_max: 7, z: 1)
|
|
@@ -166,11 +165,11 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
166
165
|
dev_tarot = nil
|
|
167
166
|
|
|
168
167
|
# get cards
|
|
169
|
-
cards_arr = cards.split(Aro::
|
|
168
|
+
cards_arr = cards.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
170
169
|
# get abs_cards
|
|
171
|
-
abs_cards_arr = cards_arr.map{|c| Aro::
|
|
170
|
+
abs_cards_arr = cards_arr.map{|c| Aro::Teck.card_strip(c)}
|
|
172
171
|
# get drawn
|
|
173
|
-
drawn_arr = drawn&.split(Aro::
|
|
172
|
+
drawn_arr = drawn&.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
174
173
|
|
|
175
174
|
if cards_arr.empty?
|
|
176
175
|
Aro::P.say("there are no cards left to draw.")
|
|
@@ -219,8 +218,8 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
219
218
|
|
|
220
219
|
# update database
|
|
221
220
|
update(
|
|
222
|
-
cards: cards_arr.join(Aro::
|
|
223
|
-
drawn: drawn_arr.join(Aro::
|
|
221
|
+
cards: cards_arr.join(Aro::Teck::CARD_DELIM.to_s),
|
|
222
|
+
drawn: drawn_arr.join(Aro::Teck::CARD_DELIM.to_s)
|
|
224
223
|
)
|
|
225
224
|
end
|
|
226
225
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
tlog.rb
|
|
4
|
+
|
|
5
|
+
teck tlog object.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require_relative :"./teck".to_s
|
|
12
|
+
|
|
13
|
+
class Aro::Tlog < ActiveRecord::Base
|
|
14
|
+
belongs_to :teck, :class_name => :"#{Aro::Teck.name}".to_s
|
|
15
|
+
|
|
16
|
+
ORDERING = {
|
|
17
|
+
ASC: :asc,
|
|
18
|
+
DESC: :desc
|
|
19
|
+
}
|
|
20
|
+
end
|
data/sys/cli/constants.rb
CHANGED
data/sys/cli/dom.rb
CHANGED
|
@@ -26,7 +26,7 @@ module CLI
|
|
|
26
26
|
Aro::P.say(I18n.t("dom.errors.failed_already_initialized"))
|
|
27
27
|
elsif Aro::Dom.in_arodom? && !Aro::Dom.is_initialized?
|
|
28
28
|
arodome = Aro::Dom.new
|
|
29
|
-
arodome.generate
|
|
29
|
+
arodome.generate(ARGV[Aro::Mancy::OS], ARGV[Aro::Mancy::E])
|
|
30
30
|
else
|
|
31
31
|
CLI::Nterface.exit_error_invalid_usage!
|
|
32
32
|
end
|
data/sys/cli/{deck.rb → teck.rb}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
teck.rb
|
|
4
4
|
|
|
5
|
-
process
|
|
5
|
+
process teck commands.
|
|
6
6
|
|
|
7
7
|
by i2097i
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
module CLI
|
|
12
12
|
# cli entrypoint
|
|
13
|
-
def self.
|
|
13
|
+
def self.teck
|
|
14
14
|
action = CLI::ARGV1&.to_sym
|
|
15
15
|
|
|
16
16
|
if CLI::FLAGS[:HELP].include?(action.to_s)
|
|
@@ -18,26 +18,26 @@ module CLI
|
|
|
18
18
|
CLI.usage::usage
|
|
19
19
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
20
20
|
elsif action.nil? || action == :aos
|
|
21
|
-
# no args, open
|
|
21
|
+
# no args, open teck menu
|
|
22
22
|
if Aro::Mancy.in_aro?
|
|
23
|
-
Aro::Db.
|
|
24
|
-
Aro::
|
|
23
|
+
Aro::Db.load
|
|
24
|
+
Aro::Teck.display_selection_menu
|
|
25
25
|
else
|
|
26
26
|
Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
|
|
27
27
|
end
|
|
28
28
|
elsif action == CLI::CMDS[:DECK][:NEW]
|
|
29
29
|
CLI::Nterface.exit_error_missing_args! if CLI::ARGV2.nil?
|
|
30
30
|
if Aro::Mancy.in_aro?
|
|
31
|
-
Aro::Db.
|
|
32
|
-
|
|
33
|
-
Aro::P.say(I18n.t("cli.messages.
|
|
34
|
-
Aro::
|
|
31
|
+
Aro::Db.load
|
|
32
|
+
teck = Aro::Teck.make(CLI::ARGV2.to_s)
|
|
33
|
+
Aro::P.say(I18n.t("cli.messages.teck_created_sucessfully", name: teck.name))
|
|
34
|
+
Aro::Teck.display_selection_menu
|
|
35
35
|
else
|
|
36
36
|
Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
|
|
37
37
|
end
|
|
38
38
|
elsif CLI::CMDS[:DECK].values.include?(action)
|
|
39
39
|
if Aro::Mancy.game.nil?
|
|
40
|
-
Aro::P.say(I18n.t("cli.errors.
|
|
40
|
+
Aro::P.say(I18n.t("cli.errors.missing_teck", cmd: Aro::Mancy::I2097I))
|
|
41
41
|
exit(CLI::EXIT_CODES[:GENERAL_ERROR])
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -76,9 +76,9 @@ module CLI
|
|
|
76
76
|
|
|
77
77
|
Aro::Mancy.game.show(**CLI::shoptions)
|
|
78
78
|
else
|
|
79
|
-
Aro::Db.
|
|
80
|
-
Aro::
|
|
81
|
-
Aro::
|
|
79
|
+
Aro::Db.load
|
|
80
|
+
Aro::Teck.select_teck(
|
|
81
|
+
Aro::Teck.find_by(name: action)
|
|
82
82
|
)
|
|
83
83
|
end
|
|
84
84
|
end
|
|
@@ -87,7 +87,7 @@ module CLI
|
|
|
87
87
|
# todo: better naming
|
|
88
88
|
def self.shoptions
|
|
89
89
|
show_options_count = Aro::Mancy::S
|
|
90
|
-
show_options_order = Aro::
|
|
90
|
+
show_options_order = Aro::Tlog::ORDERING[:DESC]
|
|
91
91
|
|
|
92
92
|
# Aro::D.say("ARGV.map{|a| a.to_sym} => #{ARGV.map{|a| a.to_sym}}")
|
|
93
93
|
|
data/sys/cli.rb
CHANGED
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
cli
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
aro cli module.
|
|
6
6
|
|
|
7
7
|
by i2097i
|
|
8
8
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
module CLI
|
|
12
|
+
# todo: set an Aro::Mancy.instance.you variable here:
|
|
12
13
|
argv_sanitized = Aos::Os.sanitize_you(ARGV.join(" ")).split(" ")
|
|
13
14
|
|
|
14
15
|
if CLI::CMDS[:DECK].values.include?(argv_sanitized[0]&.to_sym)
|
|
15
|
-
# enable
|
|
16
|
-
ARGV0 = :
|
|
16
|
+
# enable teck shortcut (skip typing teck while in-game)
|
|
17
|
+
ARGV0 = :teck
|
|
17
18
|
ARGV1 = argv_sanitized[0]&.to_sym
|
|
18
19
|
ARGV2 = argv_sanitized[1]&.to_sym
|
|
19
20
|
else
|