@@ -183,17 +183,44 @@ end
183183
184184-- simple plural s function for localisation
185185function cry_pls (str , vars )
186- if string.sub (str , 1 , 1 ) == " p" or string.sub (str , 1 , 1 ) == " s" or string.sub (str , 1 , 1 ) == " y" then
187- num = vars [tonumber (string.sub (str , 2 , - 1 ))]
188- if num then
189- if math.abs (to_big (num ) - 1 ) > to_big (0.001 ) then
190- return string.sub (str , 1 , 1 ) == " y" and " ies" or " s"
186+ local inside = str :match (" <(.-)>" ) -- finds args
187+ local _table = {}
188+ if inside then
189+ for v in inside :gmatch (" [^,]+" ) do -- adds args to array
190+ table.insert (_table , v )
191+ end
192+ end
193+ local num = vars [tonumber (string.match (str , " >(%d+)" ))] -- gets the number outside angle brackets, and its corresponding variable
194+ local plural = _table [1 ] -- default
195+ local checks = {[1 ] = " =" }
196+ if # _table > 1 then
197+ for i = 2 , # _table do
198+ local isnum = tonumber (_table [i ])
199+ if isnum then
200+ checks [isnum ] = " >" .. (_table [i + 1 ] or " " )
201+ i = i + 1
202+ elseif i == 2 then
203+ checks [1 ] = " =" .. _table [i ]
191204 else
192- return string.sub (str , 1 , 1 ) == " y" and " y" or " "
205+ print (' Unexpected string: ' .. _table [i ])
206+ end
207+ end
208+ end
209+ local function fch (str , c )
210+ return string.sub (str , 1 , 1 ) == c -- gets first char and returns boolean
211+ end
212+ for k , v in pairs (checks ) do
213+ if fch (v , ' =' ) then
214+ if math.abs (to_big (num ) - k ) < to_big (0.001 ) then
215+ return string.sub (v , 2 , - 1 )
216+ end
217+ elseif fch (v , ' >' ) then
218+ if to_big (num ) >= to_big (k - 0.001 ) then
219+ return string.sub (v , 2 , - 1 )
193220 end
194221 end
195222 end
196- return false -- idk it doesn't really matter
223+ return plural
197224end
198225
199226-- generate a random edition (e.g. Antimatter Deck)
@@ -455,6 +482,27 @@ function cry_bonusvouchermod(mod)
455482 end
456483end
457484
485+ function save_cryptid ()
486+ local data = {
487+ shinytags = {},
488+ }
489+ data .shinytags = copy_table (Cryptid .shinytagdata )
490+ compress_and_save ( G .SETTINGS .profile .. ' /' .. ' cryptidsave.jkr' , STR_PACK (data ))
491+ end
492+
493+ local sppref = set_profile_progress
494+ function set_profile_progress ()
495+ sppref ()
496+ if not Cryptid .shinytagdata .init then
497+ for k , v in pairs (G .P_TAGS ) do
498+ if Cryptid .shinytagdata [k ] == nil then
499+ Cryptid .shinytagdata .init = true
500+ Cryptid .shinytagdata [k ] = false
501+ end
502+ end
503+ end
504+ end
505+
458506Cryptid .big_num_whitelist = {
459507 j_ride_the_bus = true ,
460508 j_egg = true ,
0 commit comments