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
2
3

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

29
30

31
32
33

34
35
36
37





































38







39





40
41
42
43
44
45
46
47
48






49
50
51
52
53
54
55
..
58
59
60
61
62
63
64













65
66
67

68
69
70
71
72
73
74
75
76
77
78

79
80
81














82










83
84
-- you can use your own month names and so on; even if you change
-- the length of the year the code will adapt


local days = {
	'Day of the Frozen River'; 'Day of Fell Shadow';
	'Day of Peaceful Splendor'; 'Day of Somber Reflection'; 
	'Day of Wrathful Visitation'; 'Day of Wistful Remembrance';
	'Day of the Warm Hearth'; 'Day of Joyous Worship';
	'Day of the Fond Farewell';
}

local weeks = {
	"Merchant's Week"; "Chandler's Week"; "Miller's Week";
	"Bard's Week"; "Cobbler's Week";
}

local moons = {
	'Splendormoon';
	'Embermoon';
	'Saddlemoon';
	'Candlemoon';
	'Cindermoon';
	'Diremoon';
	'Chancelmoon';
	'Starmoon';
	'Harvestmoon';
}


local yearadj = {
	'Whimpering';

	'Overturned';
	'Silent';
	'Whimsical';

	'Turbulent';
	'Parsimonius';
	'Rhadamanthine';
	'Exuberant';





































	'Winsome';







	'Bifurcated';





}

local yearnoun = {
	'Princeling';
	'Applecart';
	'Oxcart';
	'Parsnip';
	'Lotus';
	'Daffodil';






}

local yg = function(y)
	local pos = -3
	local neg = y < 0
	y = tostring(math.abs(y))
	local n = ''
................................................................................
		if w == nil or w == '' then break end 
		n = w .. ',' .. n
		pos = pos - 3
	end
	if neg then n = '-' .. n end
	return string.sub(n,1,-2)
end














return {
	days_per_stellar_cycle = 17;

	default = 'imperial';
	styles = {
		imperial = {
			name = 'Imperial Archipelagian Calendar';
			days = days, weeks = weeks, moons = moons;
			longdate = function(date)
				local day  = days [date.day_of_week ]
				local week = weeks[date.week_of_moon]
				local moon = moons[date.moon_of_year]
				return string.format('%s on %s in %s after %s years of the Imperial Revolution',day,week,moon,yg(date.year))
			end;

			shortdate = function(date)
				return string.format('%u/%u %s I.R.', date.day_of_moon, date.moon_of_year, yg(date.year))
			end;














		}










	}
}



>
|
|
|
|
|
|
|
<
|
|
|
|
<
|
|
|
|
|
|
|
|
|
|
|
|
>
|
<
>
|
|
<
>
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>


|
|
<
<
<
<
|
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>



>


|

<

|
|
|
|

>

|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>


1
2
3
4
5
6
7
8
9
10
11

12
13
14
15

16
17
18
19
20
21
22
23
24
25
26
27
28
29

30
31
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92




93
94
95
96
97
98
99
100
101
102
103
104
105
106
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
-- you can use your own month names and so on; even if you change
-- the length of the year the code will adapt

local imperial = {
	days = {
		'Day of the Frozen River'; 'Day of Fell Shadow';
		'Day of Peaceful Splendor'; 'Day of Somber Reflection'; 
		'Day of Wrathful Visitation'; 'Day of Wistful Remembrance';
		'Day of the Warm Hearth'; 'Day of Joyous Worship';
		'Day of the Fond Farewell';
	};

	weeks = {
		"Merchant's Week"; "Chandler's Week"; "Miller's Week";
		"Bard's Week"; "Cobbler's Week";
	};

	moons = {
		'Splendormoon';
		'Embermoon';
		'Saddlemoon';
		'Candlemoon';
		'Cindermoon';
		'Diremoon';
		'Chancelmoon';
		'Starmoon';
		'Harvestmoon';
	};
}

local magisterial = {

	days = {
		'Shortmarket'; 'Fellwind'; 'Brightmorn'; 'Wandflame';
		'Goldmorrow'; 'Slaketide'; 'Longmarket'; 'Furlblossom';

	};
	weeks = {
		'Slavemarket';
		'Wandmarket';
		'Thriftmarket';
		'Darkmarket';
		'Grand Feast';
	};
	moons = {
		'Moon of Lurking Shadow';
		'Moon of Wandering Flame';
		"Wandwright's Moon";
		'Moon of Dark Waters';
		"Shipwright's Moon";
		'Moon of Singing Boughs';
		'Moon of the Golden Tower';
		"Spellwright's Moon";
		'Moon of Joysome Harvest';
		"Alchemist's Moon";
	};
	moon_abbr = {
		'MS', 'WF', 'WM', 'DM';
		'SM', 'SB', 'GT', 'Sp.';
		'JH', 'AM';
	};
}

local elerian = {
	days = {

	};
	weeks = {
		'First Week', 'Second Week', 'Third Week';
		'Fourth Week', 'Fifth Week', 'Sixth Week';
	};
	moons = {
		'Springrise';
		'Springfall';
		'Summerrise';
		'Summerfall';
		'Autumnrise';
		'Autumnfall';
		'Winterrise';
		'Winterfall';
	};
}

local adjs = {
	'Whimpering'; 'Overturned'; 'Silent'; 'Whimsical'; 'Turbulent';
	'Parsimonius'; 'Rhadamanthine'; 'Exuberant'; 'Winsome';
	'Bifurcated'; 'Shivering'; 'Splendorous'; 'Magnificent';
	'Luminous'; 'Mouthy'; 'Wandering'; 'Vexatious'; 'Irksome';
	'Wrathsome'; 'Fearsome'; 'Wretched'; 'Rambling'; 'Feculent';
	'Insipid'; 'Mad'; 'Eternal'; 'Deathless'; 'Suppurating';
	'Radiant'; 'Trembling'; 'Tremulous'; 'Incredulous'; 'False';
	'Rambunctious';
}

local nouns = {
	'Princeling'; 'Applecart'; 'Oxcart'; 'Parsnip'; 'Lotus';




	'Daffodil'; 'Slave'; 'Ass'; 'Mare'; 'Stallion';

	{false,'Fortitude'};{false,'Providence'};
	{false,'Provocation'};{false,'Wisdom'};
	{false,'Perseverance'};{false,'Destruction'};
	{false,'Suppuration'};{false,'Terror'};
	{false,'Despair'};{false,'Glory'};
}

local yg = function(y)
	local pos = -3
	local neg = y < 0
	y = tostring(math.abs(y))
	local n = ''
................................................................................
		if w == nil or w == '' then break end 
		n = w .. ',' .. n
		pos = pos - 3
	end
	if neg then n = '-' .. n end
	return string.sub(n,1,-2)
end

local classicyear = function(y)
	local aofs,nofs = (y % 7),(y % 9)
	local adj = adjs[(y*aofs) % #adjs + 1]
	local noun = nouns[(y*nofs) % #nouns + 1]
	if type(noun) == 'table' then
		noun = noun[2]
		if noun[1] then adj = 'the ' .. adj end
	else
		adj = 'the ' .. adj
	end
	return string.format('Year of %s %s', adj, noun)
end

return {
	days_per_stellar_cycle = 17;
	days_per_lunar_cycle = 32;
	default = 'imperial';
	styles = {
		imperial = sorcery.lib.tbl.merge(imperial, {
			name = 'Imperial Archipelagian Calendar';

			longdate = function(date)
				local day  = imperial.days [date.day_of_week ]
				local week = imperial.weeks[date.week_of_moon]
				local moon = imperial.moons[date.moon_of_year]
				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))
			end;
			yearname = classicyear;
			shortdate = function(date)
				return string.format('%u/%u I.R. %s', date.day_of_moon, date.moon_of_year, yg(date.year))
			end;
		});
		magisterial = sorcery.lib.tbl.merge(magisterial, {
			name = 'Old Magisterial Calendar';
			yearname = classicyear;
			longdate = function(date)
				local d,w,m = magisterial.days [date.day_of_week ],
				              magisterial.weeks[date.week_of_moon],
				              magisterial.moons[date.moon_of_year]
				if w ~= 'Grand Feast' then
					local n = ({Shortmarket = 'Short'; Longmarket = 'Long'})[d]
					if n ~= nil then
						return string.format('Day of the %s %s beneath the %s in the %s',n,w,m,classicyear(date.year))
					end
				end

				return string.format('%s in the week of the %s beneath the %s in the %s',d,w,m,classicyear(date.year))
			end;
			shortdate = function(date)
				local l = (({Shortmarket = 'S'; Longmarket = 'L'})[magisterial.days[date.day_of_week]]) or tostring(date.day_of_week)
				return string.format('%s-%s %s %sm', l,
					magisterial.weeks[date.week_of_moon],
					magisterial.moon_abbr[date.moon_of_year],
					yg(date.year+1390))
			end;
		});
	}
}