sorcery  Diff

Differences From Artifact [9f638b5b65]:

  • File data/calendar.lua — part of check-in [3f6a913e4e] at 2020-09-29 12:40:28 on branch trunk — * remove former hacky registration system, replace with consistent and flexible API; rewrite metal/gem generation to take advantage of this new API; tweaks to init system to enable world-local tweaks to lore and sorcery behavior * initial documentation commit * initial steps towards calendar - add default date format, astrolabe; prepare infra for division/melding/transmutation spells, various tweaks and fixes (user: lexi, size: 1796) [annotate] [blame] [check-ins using]

To Artifact [e37a0fcf5a]:

  • File data/calendar.lua — part of check-in [ea6e475e44] at 2020-10-19 09:52:11 on branch trunk — continue dev on celestial mechanics, add melding+division spells (resonance), refine itemclasses, add keypunch and punchcards, add paper pulp, add a shitload of visuals, add convenience scripts for working with the wiki, make the flamebolt spell actually useful instead of just a pretty lightshow, add essences, inferno crystal, and other goodies; iterate on wands, lots of shit i can't remember, various bugfixes (user: lexi, size: 4672) [annotate] [blame] [check-ins using]

     1      1   -- you can use your own month names and so on; even if you change
     2      2   -- the length of the year the code will adapt
     3      3   
     4         -local days = {
     5         -	'Day of the Frozen River'; 'Day of Fell Shadow';
     6         -	'Day of Peaceful Splendor'; 'Day of Somber Reflection'; 
     7         -	'Day of Wrathful Visitation'; 'Day of Wistful Remembrance';
     8         -	'Day of the Warm Hearth'; 'Day of Joyous Worship';
     9         -	'Day of the Fond Farewell';
            4  +local imperial = {
            5  +	days = {
            6  +		'Day of the Frozen River'; 'Day of Fell Shadow';
            7  +		'Day of Peaceful Splendor'; 'Day of Somber Reflection'; 
            8  +		'Day of Wrathful Visitation'; 'Day of Wistful Remembrance';
            9  +		'Day of the Warm Hearth'; 'Day of Joyous Worship';
           10  +		'Day of the Fond Farewell';
           11  +	};
           12  +	weeks = {
           13  +		"Merchant's Week"; "Chandler's Week"; "Miller's Week";
           14  +		"Bard's Week"; "Cobbler's Week";
           15  +	};
           16  +	moons = {
           17  +		'Splendormoon';
           18  +		'Embermoon';
           19  +		'Saddlemoon';
           20  +		'Candlemoon';
           21  +		'Cindermoon';
           22  +		'Diremoon';
           23  +		'Chancelmoon';
           24  +		'Starmoon';
           25  +		'Harvestmoon';
           26  +	};
           27  +}
           28  +
           29  +local magisterial = {
           30  +	days = {
           31  +		'Shortmarket'; 'Fellwind'; 'Brightmorn'; 'Wandflame';
           32  +		'Goldmorrow'; 'Slaketide'; 'Longmarket'; 'Furlblossom';
           33  +	};
           34  +	weeks = {
           35  +		'Slavemarket';
           36  +		'Wandmarket';
           37  +		'Thriftmarket';
           38  +		'Darkmarket';
           39  +		'Grand Feast';
           40  +	};
           41  +	moons = {
           42  +		'Moon of Lurking Shadow';
           43  +		'Moon of Wandering Flame';
           44  +		"Wandwright's Moon";
           45  +		'Moon of Dark Waters';
           46  +		"Shipwright's Moon";
           47  +		'Moon of Singing Boughs';
           48  +		'Moon of the Golden Tower';
           49  +		"Spellwright's Moon";
           50  +		'Moon of Joysome Harvest';
           51  +		"Alchemist's Moon";
           52  +	};
           53  +	moon_abbr = {
           54  +		'MS', 'WF', 'WM', 'DM';
           55  +		'SM', 'SB', 'GT', 'Sp.';
           56  +		'JH', 'AM';
           57  +	};
    10     58   }
    11     59   
    12         -local weeks = {
    13         -	"Merchant's Week"; "Chandler's Week"; "Miller's Week";
    14         -	"Bard's Week"; "Cobbler's Week";
           60  +local elerian = {
           61  +	days = {
           62  +
           63  +	};
           64  +	weeks = {
           65  +		'First Week', 'Second Week', 'Third Week';
           66  +		'Fourth Week', 'Fifth Week', 'Sixth Week';
           67  +	};
           68  +	moons = {
           69  +		'Springrise';
           70  +		'Springfall';
           71  +		'Summerrise';
           72  +		'Summerfall';
           73  +		'Autumnrise';
           74  +		'Autumnfall';
           75  +		'Winterrise';
           76  +		'Winterfall';
           77  +	};
    15     78   }
    16     79   
    17         -local moons = {
    18         -	'Splendormoon';
    19         -	'Embermoon';
    20         -	'Saddlemoon';
    21         -	'Candlemoon';
    22         -	'Cindermoon';
    23         -	'Diremoon';
    24         -	'Chancelmoon';
    25         -	'Starmoon';
    26         -	'Harvestmoon';
           80  +local adjs = {
           81  +	'Whimpering'; 'Overturned'; 'Silent'; 'Whimsical'; 'Turbulent';
           82  +	'Parsimonius'; 'Rhadamanthine'; 'Exuberant'; 'Winsome';
           83  +	'Bifurcated'; 'Shivering'; 'Splendorous'; 'Magnificent';
           84  +	'Luminous'; 'Mouthy'; 'Wandering'; 'Vexatious'; 'Irksome';
           85  +	'Wrathsome'; 'Fearsome'; 'Wretched'; 'Rambling'; 'Feculent';
           86  +	'Insipid'; 'Mad'; 'Eternal'; 'Deathless'; 'Suppurating';
           87  +	'Radiant'; 'Trembling'; 'Tremulous'; 'Incredulous'; 'False';
           88  +	'Rambunctious';
    27     89   }
    28     90   
    29         -local yearadj = {
    30         -	'Whimpering';
    31         -	'Overturned';
    32         -	'Silent';
    33         -	'Whimsical';
    34         -	'Turbulent';
    35         -	'Parsimonius';
    36         -	'Rhadamanthine';
    37         -	'Exuberant';
    38         -	'Winsome';
    39         -	'Bifurcated';
    40         -}
           91  +local nouns = {
           92  +	'Princeling'; 'Applecart'; 'Oxcart'; 'Parsnip'; 'Lotus';
           93  +	'Daffodil'; 'Slave'; 'Ass'; 'Mare'; 'Stallion';
    41     94   
    42         -local yearnoun = {
    43         -	'Princeling';
    44         -	'Applecart';
    45         -	'Oxcart';
    46         -	'Parsnip';
    47         -	'Lotus';
    48         -	'Daffodil';
           95  +	{false,'Fortitude'};{false,'Providence'};
           96  +	{false,'Provocation'};{false,'Wisdom'};
           97  +	{false,'Perseverance'};{false,'Destruction'};
           98  +	{false,'Suppuration'};{false,'Terror'};
           99  +	{false,'Despair'};{false,'Glory'};
    49    100   }
    50    101   
    51    102   local yg = function(y)
    52    103   	local pos = -3
    53    104   	local neg = y < 0
    54    105   	y = tostring(math.abs(y))
    55    106   	local n = ''
................................................................................
    58    109   		if w == nil or w == '' then break end 
    59    110   		n = w .. ',' .. n
    60    111   		pos = pos - 3
    61    112   	end
    62    113   	if neg then n = '-' .. n end
    63    114   	return string.sub(n,1,-2)
    64    115   end
          116  +
          117  +local classicyear = function(y)
          118  +	local aofs,nofs = (y % 7),(y % 9)
          119  +	local adj = adjs[(y*aofs) % #adjs + 1]
          120  +	local noun = nouns[(y*nofs) % #nouns + 1]
          121  +	if type(noun) == 'table' then
          122  +		noun = noun[2]
          123  +		if noun[1] then adj = 'the ' .. adj end
          124  +	else
          125  +		adj = 'the ' .. adj
          126  +	end
          127  +	return string.format('Year of %s %s', adj, noun)
          128  +end
    65    129   
    66    130   return {
    67    131   	days_per_stellar_cycle = 17;
          132  +	days_per_lunar_cycle = 32;
    68    133   	default = 'imperial';
    69    134   	styles = {
    70         -		imperial = {
          135  +		imperial = sorcery.lib.tbl.merge(imperial, {
    71    136   			name = 'Imperial Archipelagian Calendar';
    72         -			days = days, weeks = weeks, moons = moons;
          137  +			longdate = function(date)
          138  +				local day  = imperial.days [date.day_of_week ]
          139  +				local week = imperial.weeks[date.week_of_moon]
          140  +				local moon = imperial.moons[date.moon_of_year]
          141  +				return string.format('%s on %s in %s after %s years of the Imperial Revolution in the %s',day,week,moon,yg(date.year),classicyear(date.year))
          142  +			end;
          143  +			yearname = classicyear;
          144  +			shortdate = function(date)
          145  +				return string.format('%u/%u I.R. %s', date.day_of_moon, date.moon_of_year, yg(date.year))
          146  +			end;
          147  +		});
          148  +		magisterial = sorcery.lib.tbl.merge(magisterial, {
          149  +			name = 'Old Magisterial Calendar';
          150  +			yearname = classicyear;
    73    151   			longdate = function(date)
    74         -				local day  = days [date.day_of_week ]
    75         -				local week = weeks[date.week_of_moon]
    76         -				local moon = moons[date.moon_of_year]
    77         -				return string.format('%s on %s in %s after %s years of the Imperial Revolution',day,week,moon,yg(date.year))
          152  +				local d,w,m = magisterial.days [date.day_of_week ],
          153  +				              magisterial.weeks[date.week_of_moon],
          154  +				              magisterial.moons[date.moon_of_year]
          155  +				if w ~= 'Grand Feast' then
          156  +					local n = ({Shortmarket = 'Short'; Longmarket = 'Long'})[d]
          157  +					if n ~= nil then
          158  +						return string.format('Day of the %s %s beneath the %s in the %s',n,w,m,classicyear(date.year))
          159  +					end
          160  +				end
          161  +
          162  +				return string.format('%s in the week of the %s beneath the %s in the %s',d,w,m,classicyear(date.year))
    78    163   			end;
    79    164   			shortdate = function(date)
    80         -				return string.format('%u/%u %s I.R.', date.day_of_moon, date.moon_of_year, yg(date.year))
          165  +				local l = (({Shortmarket = 'S'; Longmarket = 'L'})[magisterial.days[date.day_of_week]]) or tostring(date.day_of_week)
          166  +				return string.format('%s-%s %s %sm', l,
          167  +					magisterial.weeks[date.week_of_moon],
          168  +					magisterial.moon_abbr[date.moon_of_year],
          169  +					yg(date.year+1390))
    81    170   			end;
    82         -		}
          171  +		});
    83    172   	}
    84    173   }