-
Notifications
You must be signed in to change notification settings - Fork 3
/
CalendarData.lua
224 lines (211 loc) · 3.86 KB
/
CalendarData.lua
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
107
108
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
local name, addon = ...;
local L = {}
local dmf = {
{
starts = 8,
finishes = 14, --ellwyn
},
{
starts = 5,
finishes = 11, --mulgore
},
{
starts = 4,
finishes = 10,
},
{
starts = 8,
finishes = 14,
},
{
starts = 6,
finishes = 12,
},
{
starts = 10,
finishes = 16,
},
{
starts = 8,
finishes = 14,
},
{
starts = 5,
finishes = 11,
},
{
starts = 9,
finishes = 15,
},
{
starts = 7,
finishes = 13,
},
{
starts = 4,
finishes = 10,
},
{
starts = 9,
finishes = 15,
},
}
local C_Calendar = {
eventsDb = {},
}
function C_Calendar.GetNumDayEvents(monthOffset, monthDay)
local ret = 0;
local now = date("*t")
for k, v in ipairs(C_Calendar.eventsDb) do
if (v.month == (C_Calendar.absDate.month + monthOffset)) and (v.monthDay == monthDay) then
ret = ret + 1;
end
end
return ret;
end
function C_Calendar.GetHolidayInfo(monthOffset, monthDay, eventIndex)
local eventsToday = {}
for k, v in ipairs(C_Calendar.eventsDb) do
if (v.month == (C_Calendar.absDate.month + monthOffset)) and (v.monthDay == monthDay) then
table.insert(eventsToday, v)
end
end
if eventsToday[eventIndex] then
return eventsToday[eventIndex];
end
end
function C_Calendar.SetAbsMonth(month, year)
C_Calendar.absDate.month = month
C_Calendar.absDate.year = year
end
function C_Calendar:Init()
self.absDate = date("*t")
--load dmf
for monthIndex, info in ipairs(dmf) do
local textureMiddle = (monthIndex % 2 == 0) and 235447 or 235450;
local textureStart = (monthIndex % 2 == 0) and 235448 or 235451;
local textureFinish = (monthIndex % 2 == 0) and 235448 or 235449;
for i = info.starts, info.finishes do
local texture;
if i == info.starts then
texture = textureStart
elseif i == info.finishes then
texture = textureFinish
else
texture = textureMiddle
end
table.insert(self.eventsDb, {
name = CALENDAR_FILTER_DARKMOON,
monthDay = i,
month = monthIndex,
texture = texture,
})
end
end
end
C_Calendar:Init()
addon.Calendar = C_Calendar;
-- Guildbook_CalendarWorldEvents = {
-- [L["DARKMOON_FAIRE"]] = {
-- ['Elwynn'] = {
-- ['Start'] = 235448,
-- ['OnGoing'] = 235447,
-- ['End'] = 235446,
-- },
-- ['Mulgore'] = {
-- ['Start'] = 235451,
-- ['OnGoing'] = 235450,
-- ['End'] = 235449,
-- },
-- },
-- [L["LOVE IS IN THE AIR"]] = {
-- ['Start'] = {
-- day = 7,
-- month = 2,
-- },
-- ['End'] = {
-- day = 20,
-- month = 2,
-- },
-- ['Texture'] = {
-- ['Start'] = 235468,
-- ['OnGoing'] = 235467,
-- ['End'] = 235466,
-- }
-- },
-- [L["CHILDRENS_WEEK"]] = {
-- ['Start'] = {
-- day = 1,
-- month = 5,
-- },
-- ['End'] = {
-- day = 7,
-- month = 5,
-- },
-- ['Texture'] = {
-- ['Start'] = 235445,
-- ['OnGoing'] = 235444,
-- ['End'] = 235443,
-- }
-- },
-- [L["MIDSUMMER_FIRE_FESTIVAL"]] = {
-- ['Start'] = {
-- day = 20,
-- month = 7,
-- },
-- ['End'] = {
-- day = 3,
-- month = 8,
-- },
-- ['Texture'] = {
-- ['Start'] = 235474,
-- ['OnGoing'] = 235473,
-- ['End'] = 235472,
-- }
-- },
-- [L["HARVEST_FESTIVAL"]] = {
-- ['Start'] = {
-- day = 27,
-- month = 9,
-- },
-- ['End'] = {
-- day = 4,
-- month = 10,
-- },
-- ['Texture'] = {
-- ['Start'] = 235465,
-- ['OnGoing'] = 235464,
-- ['End'] = 235463,
-- }
-- },
-- [L["HALLOWS_END"]] = {
-- ['Start'] = {
-- day = 18,
-- month = 10,
-- },
-- ['End'] = {
-- day = 2,
-- month = 11,
-- },
-- ['Texture'] = {
-- ['Start'] = 235462,
-- ['OnGoing'] = 235461,
-- ['End'] = 235460,
-- }
-- },
-- [L["FEAST_OF_WINTER_VEIL"]] = {
-- ['Start'] = {
-- day = 15,
-- month = 12,
-- },
-- ['End'] = {
-- day = 2,
-- month = 1,
-- },
-- ['Texture'] = {
-- ['Start'] = 235485,
-- ['OnGoing'] = 235484,
-- ['End'] = 235482,
-- }
-- },
-- }