kittyverse 0.4.5 → 0.5.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.
@@ -1,131 +1,131 @@
1
- # encoding: utf-8
2
-
3
-
4
-
5
- class Cattributes
6
- ## add cattributes (traits) type lookup to Cattribute itself - why? why not?
7
- def self.[]( key ) TraitType.find_by_key( key ).cattributes; end
8
- end
9
-
10
-
11
- class Cattribute
12
-
13
- def self.cattributes_by_name() @@cattributes_by_name ||= {}; end
14
-
15
- def self.find_by_name( name )
16
- ## note: allow string AND symbols (thus, use .to_s !!!)
17
- ## note: downcase name e.g. allow Savannah too (not just savannah)
18
- @@cattributes_by_name[ name.downcase.to_s ]
19
- end
20
-
21
- ## add "generic" convenience find helper
22
- def self.find_by( **kwargs )
23
- if kwargs[ :name ]
24
- find_by_name( kwargs[ :name ] )
25
- else
26
- ## todo/fix: throw argument except!!!
27
- nil
28
- end
29
- end
30
-
31
- def self.[]( name ) find_by_name( name ); end
32
-
33
-
34
-
35
- attr_accessor :type,
36
- :key,
37
- :name,
38
- :traits,
39
- :recipe,
40
- :count
41
-
42
- def initialize( **kwargs )
43
- update( kwargs )
44
- end
45
-
46
- def update( **kwargs )
47
- kwargs.each do |name,value|
48
- send( "#{name}=", value ) ## use "regular" plain/classic attribute setter
49
- end
50
- self ## return self for chaining
51
- end
52
-
53
-
54
-
55
- ## autofill cattributes
56
- TraitType.each do |tt|
57
- key = tt.key
58
- puts "key: #{key}"
59
-
60
- tt.cattributes ||= [] ## if nil make sure it's an empty array when starting
61
- ## pp tt
62
-
63
- next if [:secret, :prestige].include?( key)
64
-
65
- tt.traits.each do |t|
66
- ## 1) skip "unnamed" traits
67
- next if t.name.nil?
68
-
69
- pp t.name
70
-
71
- ## 2) special case for totesbasic - one cattribute, three traits
72
- ## (that is, Totesbasic 1, Totesbasic 2, Totesbasic 3)
73
- if TOTESBASIC.include?( t.name )
74
- if t.name == TOTESBASIC.first
75
- t1 = Traits[ TOTESBASIC[0] ]
76
- t2 = Traits[ TOTESBASIC[1] ]
77
- t3 = Traits[ TOTESBASIC[2] ]
78
-
79
- cattribute = Cattribute.new(
80
- key: 'totesbasic'.to_sym,
81
- name: 'Totesbasic',
82
- type: tt,
83
- traits: [t1,t2,t3]
84
- )
85
- else
86
- next ## skip all other totesbasic traits
87
- end
88
- else
89
- cattribute = Cattribute.new(
90
- key: t.name.to_sym,
91
- name: t.name,
92
- type: tt,
93
- traits: [t]
94
- )
95
- ## pp cattribute
96
- end
97
-
98
- tt.cattributes << cattribute
99
-
100
- cattributes_by_name[ cattribute.name.downcase ] = cattribute
101
- end
102
- end
103
-
104
- ## add purrstiges traits
105
- tt = Traits[:prestige]
106
- tt.cattributes ||= [] ## if nil make sure it's an empty array when starting
107
- PURRSTIGES.each do |key, h|
108
- puts "key: #{key}"
109
- pp h
110
-
111
- recipe = Recipe.new(
112
- traits: h[:recipe][:traits], ## todo/fix: turn strings into trait objs!!!!
113
- limit: h[:recipe][:limit],
114
- time_start: h[:recipe][:time] && h[:recipe][:time][:start] ? Date.strptime( h[:recipe][:time][:start], '%Y-%m-%d' ) : nil,
115
- time_end: h[:recipe][:time] && h[:recipe][:time][:end] ? Date.strptime( h[:recipe][:time][:end], '%Y-%m-%d' ) : nil )
116
-
117
- cattribute = Cattribute.new(
118
- key: key,
119
- name: h[:name],
120
- type: tt,
121
- traits: [], ## empty traits
122
- count: h[:recipe][:count], # note: add count from recipe hash (NOT incl. in recipe struct)
123
- recipe: recipe
124
- )
125
- tt.cattributes << cattribute
126
-
127
- cattributes_by_name[ cattribute.name.downcase ] = cattribute
128
- end
129
-
130
-
131
- end # class Cattribute
1
+ # encoding: utf-8
2
+
3
+
4
+
5
+ class Cattributes
6
+ ## add cattributes (traits) type lookup to Cattribute itself - why? why not?
7
+ def self.[]( key ) TraitType.find_by_key( key ).cattributes; end
8
+ end
9
+
10
+
11
+ class Cattribute
12
+
13
+ def self.cattributes_by_name() @@cattributes_by_name ||= {}; end
14
+
15
+ def self.find_by_name( name )
16
+ ## note: allow string AND symbols (thus, use .to_s !!!)
17
+ ## note: downcase name e.g. allow Savannah too (not just savannah)
18
+ @@cattributes_by_name[ name.downcase.to_s ]
19
+ end
20
+
21
+ ## add "generic" convenience find helper
22
+ def self.find_by( **kwargs )
23
+ if kwargs[ :name ]
24
+ find_by_name( kwargs[ :name ] )
25
+ else
26
+ ## todo/fix: throw argument except!!!
27
+ nil
28
+ end
29
+ end
30
+
31
+ def self.[]( name ) find_by_name( name ); end
32
+
33
+
34
+
35
+ attr_accessor :type,
36
+ :key,
37
+ :name,
38
+ :traits,
39
+ :recipe,
40
+ :count
41
+
42
+ def initialize( **kwargs )
43
+ update( kwargs )
44
+ end
45
+
46
+ def update( **kwargs )
47
+ kwargs.each do |name,value|
48
+ send( "#{name}=", value ) ## use "regular" plain/classic attribute setter
49
+ end
50
+ self ## return self for chaining
51
+ end
52
+
53
+
54
+
55
+ ## autofill cattributes
56
+ TraitType.each do |tt|
57
+ key = tt.key
58
+ puts "key: #{key}"
59
+
60
+ tt.cattributes ||= [] ## if nil make sure it's an empty array when starting
61
+ ## pp tt
62
+
63
+ next if [:secret, :prestige].include?( key)
64
+
65
+ tt.traits.each do |t|
66
+ ## 1) skip "unnamed" traits
67
+ next if t.name.nil?
68
+
69
+ pp t.name
70
+
71
+ ## 2) special case for totesbasic - one cattribute, three traits
72
+ ## (that is, Totesbasic 1, Totesbasic 2, Totesbasic 3)
73
+ if TOTESBASIC.include?( t.name )
74
+ if t.name == TOTESBASIC.first
75
+ t1 = Traits[ TOTESBASIC[0] ]
76
+ t2 = Traits[ TOTESBASIC[1] ]
77
+ t3 = Traits[ TOTESBASIC[2] ]
78
+
79
+ cattribute = Cattribute.new(
80
+ key: 'totesbasic'.to_sym,
81
+ name: 'Totesbasic',
82
+ type: tt,
83
+ traits: [t1,t2,t3]
84
+ )
85
+ else
86
+ next ## skip all other totesbasic traits
87
+ end
88
+ else
89
+ cattribute = Cattribute.new(
90
+ key: t.name.to_sym,
91
+ name: t.name,
92
+ type: tt,
93
+ traits: [t]
94
+ )
95
+ ## pp cattribute
96
+ end
97
+
98
+ tt.cattributes << cattribute
99
+
100
+ cattributes_by_name[ cattribute.name.downcase ] = cattribute
101
+ end
102
+ end
103
+
104
+ ## add purrstiges traits
105
+ tt = Traits[:prestige]
106
+ tt.cattributes ||= [] ## if nil make sure it's an empty array when starting
107
+ PURRSTIGES.each do |key, h|
108
+ puts "key: #{key}"
109
+ pp h
110
+
111
+ recipe = Recipe.new(
112
+ traits: h[:recipe][:traits], ## todo/fix: turn strings into trait objs!!!!
113
+ limit: h[:recipe][:limit],
114
+ time_start: h[:recipe][:time] && h[:recipe][:time][:start] ? Date.strptime( h[:recipe][:time][:start], '%Y-%m-%d' ) : nil,
115
+ time_end: h[:recipe][:time] && h[:recipe][:time][:end] ? Date.strptime( h[:recipe][:time][:end], '%Y-%m-%d' ) : nil )
116
+
117
+ cattribute = Cattribute.new(
118
+ key: key,
119
+ name: h[:name],
120
+ type: tt,
121
+ traits: [], ## empty traits
122
+ count: h[:recipe][:count], # note: add count from recipe hash (NOT incl. in recipe struct)
123
+ recipe: recipe
124
+ )
125
+ tt.cattributes << cattribute
126
+
127
+ cattributes_by_name[ cattribute.name.downcase ] = cattribute
128
+ end
129
+
130
+
131
+ end # class Cattribute
@@ -1,146 +1,146 @@
1
- # encoding: utf-8
2
-
3
- ## 31 colors body
4
- COLORS_BODY = {
5
- meowgarine: "#fcfc95",
6
- cornflower: "#7592fc",
7
- icicle: "#c5e2ff",
8
- hotcocoa: "#5e4a47",
9
- firstblush: "#fcd0f8",
10
- tundra: "#dbccbf",
11
- glacier: "#ccffff",
12
- hyacinth: "#a45de2",
13
- shamrock: "#50c878",
14
- shadowgrey: "#b1b1be",
15
- salmon: "#f4a792",
16
- orangesoda: "#f7bc56",
17
- cottoncandy: "#ecd1eb",
18
- mauveover: "#ded0ee",
19
- aquamarine: "#add5d2",
20
- nachocheez: "#fcda86",
21
- harbourfog: "#afb4d5",
22
- cinderella: "#5ab0f1",
23
- greymatter: "#d1dadf",
24
- brownies: "#b78662",
25
- dragonfruit: "#ec79f2",
26
- hintomint: "#d0ead2",
27
- bananacream: "#f8f8e0",
28
- cloudwhite: "#ffffff",
29
- oldlace: "#ffebe9",
30
- koala: "#85828a",
31
- lavender: "#bc99ff",
32
- redvelvet: "#f77272",
33
- verdigris: "#73ffc3",
34
- onyx: "#42414c",
35
- martian: "#a4ff6f"
36
- }
37
-
38
- ## 31 colors eyes
39
- COLORS_EYES = {
40
- olive: "#729100",
41
- pinefresh: "#177a25",
42
- oasis: "#ccffef",
43
- dioscuri: "#0ba09c",
44
- isotope: "#e4ff73",
45
- bridesmaid: "#ffc2df",
46
- downbythebay: "#83b293",
47
- gemini: "#ffd150",
48
- kaleidoscope: "#bcba5e",
49
- thundergrey: "#828282",
50
- gold: "#fcdf35",
51
- topaz: "#0ba09c",
52
- mintgreen: "#43edac",
53
- sizzurp: "#7c40ff",
54
- chestnut: "#a56429",
55
- strawberry: "#ef4b62",
56
- sapphire: "#4c7aef",
57
- forgetmenot: "#4eb4f9",
58
- dahlia: "#b8bdff",
59
- coralsunrise: "#ff9088",
60
- doridnudibranch: "#fa9fff",
61
- parakeet: "#49b749",
62
- cyan: "#45f0f4",
63
- pumpkin: "#ffa039",
64
- limegreen: "#aef72f",
65
- bubblegum: "#ef52d1",
66
- twilightsparkle: "#ba8aff",
67
- palejade: "#c3d8cf",
68
- eclipse: "#484c5b",
69
- babypuke: "#bcba5e",
70
- autumnmoon: "#ffe8bb"
71
- }
72
-
73
- ## 31 colors secondary
74
- COLORS_SECONDARY = {
75
- cyborg: "#959cae",
76
- ooze: "#daea31",
77
- peppermint: "#00a86b",
78
- inflatablepool: "#4fb9c5",
79
- prairierose: "#e0115f",
80
- springcrocus: "#ab7fef",
81
- egyptiankohl: "#4a4855",
82
- poisonberry: "#773c5f",
83
- lilac: "#e5e5f9",
84
- apricot: "#f4a45b",
85
- royalpurple: "#cf5be8",
86
- padparadscha: "#ffd5c7",
87
- swampgreen: "#44e192",
88
- violet: "#765be8",
89
- scarlet: "#ea5f5a",
90
- barkbrown: "#886662",
91
- coffee: "#756650",
92
- lemonade: "#ffef85",
93
- chocolate: "#c47e33",
94
- butterscotch: "#ffce6c",
95
- safetyvest: "#b0f852",
96
- turtleback: "#387573",
97
- rosequartz: "#ffaefb",
98
- wolfgrey: "#737184",
99
- cerulian: "#385877",
100
- skyblue: "#83d5ff",
101
- garnet: "#f4679a",
102
- universe: "#494981",
103
- royalblue: "#5b6ee8",
104
- mertail: "#36f2bc",
105
- pearl: "#fff8fa"
106
- }
107
-
108
- ## 31 colors tertiary
109
- COLORS_TERTIARY = {
110
- hanauma: "#7accb5",
111
- belleblue: "#afd0f7",
112
- peach: "#f9cfad",
113
- granitegrey: "#b1aeb9",
114
- kittencream: "#f7ebda",
115
- emeraldgreen: "#8be179",
116
- bloodred: "#ff7a7a",
117
- daffodil: "#fff09f",
118
- sandalwood: "#b8916c",
119
- icy: "#eef8f8",
120
- flamingo: "#ec87ba",
121
- seafoam: "#9eeec5",
122
- azaleablush: "#ffccd8",
123
- morningglory: "#887cff",
124
- purplehaze: "#dad6e1",
125
- missmuffett: "#f4b3f0",
126
- summerbonnet: "#cbb0ff",
127
- mallowflower: "#c170b1",
128
- fallspice: "#ff9331",
129
- dreamboat: "#fd6cd5",
130
- periwinkle: "#cacaff",
131
- frosting: "#ffdce6",
132
- patrickstarfish: "#ffad97",
133
- mintmacaron: "#b0f1f4",
134
- shale: "#585666",
135
- cashewmilk: "#f9efef",
136
- buttercup: "#f4e65d",
137
- cobalt: "#5262db",
138
- sully: "#70f9f9",
139
- kalahari: "#ffcf8a",
140
- atlantis: "#2a7f96"
141
- }
142
-
143
- COLORS = {}.merge( COLORS_BODY )
144
- .merge( COLORS_EYES )
145
- .merge( COLORS_SECONDARY )
146
- .merge( COLORS_TERTIARY )
1
+ # encoding: utf-8
2
+
3
+ ## 31 colors body
4
+ COLORS_BODY = {
5
+ meowgarine: "#fcfc95",
6
+ cornflower: "#7592fc",
7
+ icicle: "#c5e2ff",
8
+ hotcocoa: "#5e4a47",
9
+ firstblush: "#fcd0f8",
10
+ tundra: "#dbccbf",
11
+ glacier: "#ccffff",
12
+ hyacinth: "#a45de2",
13
+ shamrock: "#50c878",
14
+ shadowgrey: "#b1b1be",
15
+ salmon: "#f4a792",
16
+ orangesoda: "#f7bc56",
17
+ cottoncandy: "#ecd1eb",
18
+ mauveover: "#ded0ee",
19
+ aquamarine: "#add5d2",
20
+ nachocheez: "#fcda86",
21
+ harbourfog: "#afb4d5",
22
+ cinderella: "#5ab0f1",
23
+ greymatter: "#d1dadf",
24
+ brownies: "#b78662",
25
+ dragonfruit: "#ec79f2",
26
+ hintomint: "#d0ead2",
27
+ bananacream: "#f8f8e0",
28
+ cloudwhite: "#ffffff",
29
+ oldlace: "#ffebe9",
30
+ koala: "#85828a",
31
+ lavender: "#bc99ff",
32
+ redvelvet: "#f77272",
33
+ verdigris: "#73ffc3",
34
+ onyx: "#42414c",
35
+ martian: "#a4ff6f"
36
+ }
37
+
38
+ ## 31 colors eyes
39
+ COLORS_EYES = {
40
+ olive: "#729100",
41
+ pinefresh: "#177a25",
42
+ oasis: "#ccffef",
43
+ dioscuri: "#0ba09c",
44
+ isotope: "#e4ff73",
45
+ bridesmaid: "#ffc2df",
46
+ downbythebay: "#83b293",
47
+ gemini: "#ffd150",
48
+ kaleidoscope: "#bcba5e",
49
+ thundergrey: "#828282",
50
+ gold: "#fcdf35",
51
+ topaz: "#0ba09c",
52
+ mintgreen: "#43edac",
53
+ sizzurp: "#7c40ff",
54
+ chestnut: "#a56429",
55
+ strawberry: "#ef4b62",
56
+ sapphire: "#4c7aef",
57
+ forgetmenot: "#4eb4f9",
58
+ dahlia: "#b8bdff",
59
+ coralsunrise: "#ff9088",
60
+ doridnudibranch: "#fa9fff",
61
+ parakeet: "#49b749",
62
+ cyan: "#45f0f4",
63
+ pumpkin: "#ffa039",
64
+ limegreen: "#aef72f",
65
+ bubblegum: "#ef52d1",
66
+ twilightsparkle: "#ba8aff",
67
+ palejade: "#c3d8cf",
68
+ eclipse: "#484c5b",
69
+ babypuke: "#bcba5e",
70
+ autumnmoon: "#ffe8bb"
71
+ }
72
+
73
+ ## 31 colors secondary
74
+ COLORS_SECONDARY = {
75
+ cyborg: "#959cae",
76
+ ooze: "#daea31",
77
+ peppermint: "#00a86b",
78
+ inflatablepool: "#4fb9c5",
79
+ prairierose: "#e0115f",
80
+ springcrocus: "#ab7fef",
81
+ egyptiankohl: "#4a4855",
82
+ poisonberry: "#773c5f",
83
+ lilac: "#e5e5f9",
84
+ apricot: "#f4a45b",
85
+ royalpurple: "#cf5be8",
86
+ padparadscha: "#ffd5c7",
87
+ swampgreen: "#44e192",
88
+ violet: "#765be8",
89
+ scarlet: "#ea5f5a",
90
+ barkbrown: "#886662",
91
+ coffee: "#756650",
92
+ lemonade: "#ffef85",
93
+ chocolate: "#c47e33",
94
+ butterscotch: "#ffce6c",
95
+ safetyvest: "#b0f852",
96
+ turtleback: "#387573",
97
+ rosequartz: "#ffaefb",
98
+ wolfgrey: "#737184",
99
+ cerulian: "#385877",
100
+ skyblue: "#83d5ff",
101
+ garnet: "#f4679a",
102
+ universe: "#494981",
103
+ royalblue: "#5b6ee8",
104
+ mertail: "#36f2bc",
105
+ pearl: "#fff8fa"
106
+ }
107
+
108
+ ## 31 colors tertiary
109
+ COLORS_TERTIARY = {
110
+ hanauma: "#7accb5",
111
+ belleblue: "#afd0f7",
112
+ peach: "#f9cfad",
113
+ granitegrey: "#b1aeb9",
114
+ kittencream: "#f7ebda",
115
+ emeraldgreen: "#8be179",
116
+ bloodred: "#ff7a7a",
117
+ daffodil: "#fff09f",
118
+ sandalwood: "#b8916c",
119
+ icy: "#eef8f8",
120
+ flamingo: "#ec87ba",
121
+ seafoam: "#9eeec5",
122
+ azaleablush: "#ffccd8",
123
+ morningglory: "#887cff",
124
+ purplehaze: "#dad6e1",
125
+ missmuffett: "#f4b3f0",
126
+ summerbonnet: "#cbb0ff",
127
+ mallowflower: "#c170b1",
128
+ fallspice: "#ff9331",
129
+ dreamboat: "#fd6cd5",
130
+ periwinkle: "#cacaff",
131
+ frosting: "#ffdce6",
132
+ patrickstarfish: "#ffad97",
133
+ mintmacaron: "#b0f1f4",
134
+ shale: "#585666",
135
+ cashewmilk: "#f9efef",
136
+ buttercup: "#f4e65d",
137
+ cobalt: "#5262db",
138
+ sully: "#70f9f9",
139
+ kalahari: "#ffcf8a",
140
+ atlantis: "#2a7f96"
141
+ }
142
+
143
+ COLORS = {}.merge( COLORS_BODY )
144
+ .merge( COLORS_EYES )
145
+ .merge( COLORS_SECONDARY )
146
+ .merge( COLORS_TERTIARY )