Elin Decompiled Documentation EA 23.286 Nightly Patch 1
Loading...
Searching...
No Matches
Date Class Reference
Inheritance diagram for Date:
EClass GameDate VirtualDate

Public Types

enum  TextFormat {
  Default , Log , Widget , Schedule ,
  Travel , YearMonthDay , LogPlusYear
}
 

Public Member Functions

Date Copy ()
 
override string ToString ()
 
void AddHour (int a)
 
void AddDay (int a)
 
void AddMonth (int a)
 
string GetText (TextFormat format)
 
int GetRawReal (int offsetHours=0)
 
int GetRaw (int offsetHours=0)
 
int GetRawDay ()
 
bool IsExpired (int time)
 
int GetRemainingHours (int rawDeadLine)
 
int GetRemainingSecs (int rawDeadLine)
 
int GetElapsedMins (int rawDate)
 
int GetElapsedHour (int rawDate)
 

Static Public Member Functions

static string GetText (int raw, TextFormat format)
 
static string GetText (int hour)
 
static string GetText2 (int hour)
 
static string SecToDate (int sec)
 
static string MinToDayAndHour (int min)
 
static int[] GetDateArray (int raw)
 
static Date ToDate (int raw)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Public Attributes

int[] raw = new int[6]
 

Static Public Attributes

const int ShippingHour = 5
 
const int HourToken = 60
 
const int DayToken = 1440
 
const int MonthToken = 43200
 
const int YearToken = 518400
 
const int HourTokenReal = 60
 
const int DayTokenReal = 1440
 
const int MonthTokenReal = 46080
 
const int YearTokenReal = 552960
 
- Static Public Attributes inherited from EClass
static Core core
 

Properties

int year [get, set]
 
int month [get, set]
 
int day [get, set]
 
int hour [get, set]
 
int min [get, set]
 
int sec [get, set]
 
bool IsDay [get]
 
bool IsNight [get]
 
int HourMorning [get]
 
int HourNight [get]
 
PeriodOfDay periodOfDay [get]
 
string NameMonth [get]
 
string NameSeason [get]
 
string NameMonthShort [get]
 
string NameTime [get]
 
bool IsSpring [get]
 
bool IsSummer [get]
 
bool IsAutumn [get]
 
bool IsWinter [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 3 of file Date.cs.

Member Enumeration Documentation

◆ TextFormat

Enumerator
Default 
Log 
Widget 
Schedule 
Travel 
YearMonthDay 
LogPlusYear 

Definition at line 5 of file Date.cs.

Member Function Documentation

◆ AddDay()

void Date.AddDay ( int  a)
inline

Definition at line 231 of file Date.cs.

232 {
233 day += a;
234 while (day > 30)
235 {
236 day -= 30;
237 AddMonth(1);
238 }
239 }
void AddMonth(int a)
Definition: Date.cs:241
int day
Definition: Date.cs:62

References AddMonth(), and day.

Referenced by AddHour().

◆ AddHour()

void Date.AddHour ( int  a)
inline

Definition at line 221 of file Date.cs.

222 {
223 hour += a;
224 while (hour >= 24)
225 {
226 hour -= 24;
227 AddDay(1);
228 }
229 }
int hour
Definition: Date.cs:74
void AddDay(int a)
Definition: Date.cs:231

References AddDay(), and hour.

Referenced by Weather.GetForecast(), Weather.GetWeatherForecast(), and Weather.RefreshForecasts().

◆ AddMonth()

void Date.AddMonth ( int  a)
inline

Definition at line 241 of file Date.cs.

242 {
243 month += a;
244 while (month > 12)
245 {
246 month -= 12;
247 year++;
248 }
249 }
int month
Definition: Date.cs:50
int year
Definition: Date.cs:38

References month, and year.

Referenced by AddDay(), and FortuneRollData.Refresh().

◆ Copy()

Date Date.Copy ( )
inline

Definition at line 203 of file Date.cs.

204 {
205 return new Date
206 {
207 year = year,
208 month = month,
209 day = day,
210 hour = hour,
211 min = min,
212 sec = sec
213 };
214 }
Definition: Date.cs:4
int min
Definition: Date.cs:86
int sec
Definition: Date.cs:98

References day, hour, min, month, sec, and year.

Referenced by GameIndex.Create(), Weather.GetWeatherForecast(), FortuneRollData.Refresh(), and Weather.RefreshForecasts().

◆ GetDateArray()

static int[] Date.GetDateArray ( int  raw)
inlinestatic

Definition at line 387 of file Date.cs.

388 {
389 return new int[5]
390 {
391 raw % 60,
392 raw / 60 % 24,
393 raw / 60 / 24 % 30,
394 raw / 60 / 24 / 30 % 12,
395 raw / 60 / 24 / 30 / 12
396 };
397 }
int[] raw
Definition: Date.cs:19

References raw.

Referenced by ToDate().

◆ GetElapsedHour()

int Date.GetElapsedHour ( int  rawDate)
inline

Definition at line 358 of file Date.cs.

359 {
360 if (rawDate != 0)
361 {
362 return (GetRaw() - rawDate) / 60;
363 }
364 return 0;
365 }
int GetRaw(int offsetHours=0)
Definition: Date.cs:328

References GetRaw().

Referenced by Player.MoveZone().

◆ GetElapsedMins()

int Date.GetElapsedMins ( int  rawDate)
inline

Definition at line 353 of file Date.cs.

354 {
355 return GetRaw() - rawDate;
356 }

References GetRaw().

Referenced by Weather.GetTimeSinceLastRain().

◆ GetRaw()

int Date.GetRaw ( int  offsetHours = 0)
inline

Definition at line 328 of file Date.cs.

329 {
330 return min + (hour + offsetHours) * 60 + day * 1440 + month * 43200 + year * 518400;
331 }

References day, hour, min, month, and year.

Referenced by InvOwnerGene._OnProcess(), Zone.AbandonZone(), Zone.Activate(), MeetingManager.Add(), FactionBranch.AddRecruit(), Faction.AddReserve(), DramaCustomSequence.Build(), Card.CheckJustCooked(), Region.CheckRandomSites(), Zone.ClaimZone(), TraitSpotBiome.CountNotableThing(), SpatialGen.CreateInstance(), Region.CreateRandomSite(), Zone.Deactivate(), DramaOutcome.get_scratch(), GetElapsedHour(), GetElapsedMins(), MsgLog.GetList(), GetRemainingHours(), GetRemainingSecs(), Quest.Init(), IsExpired(), Quest.IsVisibleOnQuestBoard(), TraitMoongate.LoadMap(), RecipeCard.MakeDish(), Chara.Marry(), Chara.ModAffinity(), Player.MoveZone(), Trait.OnBarter(), BaseListPeople.OnClick(), QuestLoytelFarm.OnComplete(), QuestShippingChest.OnComplete(), QuestVernis.OnComplete(), FactionBranch.OnCreate(), QuestDialog.OnDropReward(), Zone_Field.OnGenerateMap(), ZoneEventRaid.OnKill(), Game.OnLoad(), QuestIntoDarkness.OnStart(), Player.OnStartNewGame(), TraitHat.OnUse(), Zone.OnVisit(), FoodEffect.Proc(), ActEffect.ProcAt(), FortuneRollData.Refresh(), LayerTravel.Refresh(), Zone.Revive(), AI_Idle.Run(), AI_Slaughter.Run(), AI_Steal.Run(), Weather.SetCondition(), GameDate.ShipGoods(), Chara.ShowDialog(), SurvivalManager.StartRaid(), SlaverData.TryRefresh(), GoalCombat.TryUseAbility(), Chara.TryWorkOutside(), and Zone.UpdateQuests().

◆ GetRawDay()

int Date.GetRawDay ( )
inline

Definition at line 333 of file Date.cs.

334 {
335 return day * 1440 + month * 43200 + year * 518400;
336 }

References day, month, and year.

◆ GetRawReal()

int Date.GetRawReal ( int  offsetHours = 0)
inline

Definition at line 323 of file Date.cs.

324 {
325 return min + (hour + offsetHours) * 60 + day * 1440 + month * 46080 + year * 552960;
326 }

References day, hour, min, month, and year.

Referenced by GameIO.GetGameList().

◆ GetRemainingHours()

int Date.GetRemainingHours ( int  rawDeadLine)
inline

◆ GetRemainingSecs()

int Date.GetRemainingSecs ( int  rawDeadLine)
inline

Definition at line 348 of file Date.cs.

349 {
350 return rawDeadLine - GetRaw();
351 }

References GetRaw().

◆ GetText() [1/3]

static string Date.GetText ( int  hour)
inlinestatic

Definition at line 297 of file Date.cs.

298 {
299 if (hour < 0)
300 {
301 return "dateDayVoid".lang();
302 }
303 if (hour > 24)
304 {
305 return "dateDay".lang((hour / 24).ToString() ?? "");
306 }
307 return "dateHour".lang(hour.ToString() ?? "");
308 }
override string ToString()
Definition: Date.cs:216

References hour, and ToString().

◆ GetText() [2/3]

static string Date.GetText ( int  raw,
TextFormat  format 
)
inlinestatic

Definition at line 292 of file Date.cs.

293 {
294 return ToDate(raw).GetText(format);
295 }
static Date ToDate(int raw)
Definition: Date.cs:399
string GetText(TextFormat format)
Definition: Date.cs:251

References GetText(), raw, and ToDate().

◆ GetText() [3/3]

string Date.GetText ( TextFormat  format)
inline

Definition at line 251 of file Date.cs.

252 {
253 switch (format)
254 {
255 case TextFormat.LogPlusYear:
256 return year + ", " + month + "/" + day + " " + ((hour < 10) ? "0" : "") + hour + ":" + ((min < 10) ? "0" : "") + min;
257 case TextFormat.Log:
258 return month + "/" + day + " " + hour + ":" + min;
259 case TextFormat.Widget:
260 return "dateYearMonthDay".lang(year.ToString() ?? "", month.ToString() ?? "", day.ToString() ?? "");
261 case TextFormat.Schedule:
262 return "dateSchedule".lang(NameMonthShort, day.ToString() ?? "");
263 case TextFormat.Travel:
264 {
265 string text = "_short";
266 if (format == TextFormat.Travel)
267 {
268 return "travelDate".lang(year.ToString() ?? "", month.ToString() ?? "", day.ToString() ?? "");
269 }
270 string text2 = "";
271 if (day != 0)
272 {
273 text2 = text2 + day + Lang.Get("wDay" + text);
274 }
275 if (hour != 0)
276 {
277 text2 = text2 + hour + Lang.Get("wHour" + text);
278 }
279 if (min != 0)
280 {
281 text2 = text2 + min + Lang.Get("wMin" + text);
282 }
283 return text2 + sec + Lang.Get("wSec" + text);
284 }
285 case TextFormat.YearMonthDay:
286 return "dateYearMonthDay".lang(year.ToString() ?? "", month.ToString() ?? "", day.ToString() ?? "");
287 default:
288 return "Day " + day + " " + hour + ":" + min;
289 }
290 }
string NameMonthShort
Definition: Date.cs:151
TextFormat
Definition: Date.cs:6
Definition: Lang.cs:7
static string Get(string id)
Definition: Lang.cs:94

References day, Lang.Get(), hour, min, month, NameMonthShort, sec, and year.

Referenced by WidgetDate._Refresh(), GetText(), Trait.GetTextRestock(), Player.MoveZone(), BaseListPeople.OnClick(), UIHomeInfo.RefreshInfo(), ItemQuest.SetQuest(), and ToString().

◆ GetText2()

static string Date.GetText2 ( int  hour)
inlinestatic

Definition at line 310 of file Date.cs.

311 {
312 if (hour < 0)
313 {
314 return "-";
315 }
316 if (hour > 24)
317 {
318 return hour / 24 + "d";
319 }
320 return hour + "h";
321 }

References hour.

Referenced by LayerTravel.Refresh().

◆ IsExpired()

◆ MinToDayAndHour()

static string Date.MinToDayAndHour ( int  min)
inlinestatic

Definition at line 372 of file Date.cs.

373 {
374 int num = min / 60;
375 int num2 = num / 24;
376 if (num == 0)
377 {
378 return min + "分";
379 }
380 if (num2 != 0)
381 {
382 return num2 + "日と" + num % 24 + "時間";
383 }
384 return num + "時間";
385 }

References min.

◆ SecToDate()

static string Date.SecToDate ( int  sec)
inlinestatic

Definition at line 367 of file Date.cs.

368 {
369 return sec / 60 / 60 + "時間 " + sec / 60 % 60 + "分 " + sec % 60 + "秒";
370 }

References sec.

◆ ToDate()

static Date Date.ToDate ( int  raw)
inlinestatic

Definition at line 399 of file Date.cs.

400 {
401 int[] dateArray = GetDateArray(raw);
402 int num = dateArray[4];
403 int num2 = dateArray[3];
404 int num3 = dateArray[2];
405 if (num2 == 0)
406 {
407 num2 = 12;
408 num--;
409 }
410 if (num3 == 0)
411 {
412 num3 = 30;
413 num2--;
414 }
415 if (num2 == 0)
416 {
417 num2 = 12;
418 num--;
419 }
420 return new Date
421 {
422 min = dateArray[0],
423 hour = dateArray[1],
424 day = num3,
425 month = num2,
426 year = num
427 };
428 }
static int[] GetDateArray(int raw)
Definition: Date.cs:387

References day, GetDateArray(), hour, min, month, raw, and year.

Referenced by GameDate.AdvanceDay(), GetText(), WindowChara.RefreshNote(), and LayerShippingResult.Show().

◆ ToString()

override string Date.ToString ( )
inline

Definition at line 216 of file Date.cs.

217 {
218 return GetText(TextFormat.Log);
219 }

References GetText().

Referenced by GetText().

Member Data Documentation

◆ DayToken

const int Date.DayToken = 1440
static

Definition at line 23 of file Date.cs.

◆ DayTokenReal

const int Date.DayTokenReal = 1440
static

Definition at line 31 of file Date.cs.

◆ HourToken

const int Date.HourToken = 60
static

Definition at line 21 of file Date.cs.

◆ HourTokenReal

const int Date.HourTokenReal = 60
static

Definition at line 29 of file Date.cs.

◆ MonthToken

const int Date.MonthToken = 43200
static

Definition at line 25 of file Date.cs.

◆ MonthTokenReal

const int Date.MonthTokenReal = 46080
static

Definition at line 33 of file Date.cs.

◆ raw

int [] Date.raw = new int[6]

Definition at line 19 of file Date.cs.

Referenced by GetDateArray(), GetText(), ToDate(), and VirtualDate.VirtualDate().

◆ ShippingHour

const int Date.ShippingHour = 5
static

Definition at line 16 of file Date.cs.

◆ YearToken

const int Date.YearToken = 518400
static

Definition at line 27 of file Date.cs.

◆ YearTokenReal

const int Date.YearTokenReal = 552960
static

Definition at line 35 of file Date.cs.

Property Documentation

◆ day

◆ hour

int Date.hour
getset

Definition at line 73 of file Date.cs.

74 {
75 get
76 {
77 return raw[3];
78 }
79 set
80 {
81 raw[3] = value;
82 }
83 }

Referenced by AddHour(), Chara.ChooseNewGoal(), Copy(), GetRaw(), GetRawReal(), GetText(), GetText2(), WidgetArtTool.OnActivate(), Region.OnAdvanceHour(), TraitDaggerGrave.OnUse(), Chara.TickWork(), ToDate(), and Trait.TryToggle().

◆ HourMorning

int Date.HourMorning
get

Definition at line 123 of file Date.cs.

◆ HourNight

int Date.HourNight
get

Definition at line 125 of file Date.cs.

◆ IsAutumn

bool Date.IsAutumn
get

Definition at line 179 of file Date.cs.

180 {
181 get
182 {
183 if (month >= 9)
184 {
185 return month <= 11;
186 }
187 return false;
188 }
189 }

◆ IsDay

bool Date.IsDay
get

Definition at line 109 of file Date.cs.

Referenced by GameUpdater.Update().

◆ IsNight

bool Date.IsNight
get

Definition at line 111 of file Date.cs.

112 {
113 get
114 {
115 if (hour < HourNight)
116 {
117 return hour <= HourMorning;
118 }
119 return true;
120 }
121 }
int HourMorning
Definition: Date.cs:123
int HourNight
Definition: Date.cs:125

Referenced by Chara.CanDuplicate(), BaseTileMap.DrawTile(), Card.GetLightRadius(), BaseGameScreen.RefreshSky(), CoreConfig.RefreshUIBrightness(), BaseGameScreen.RefreshWeather(), AI_Idle.Run(), Zone.Simulate(), and ConVampire.Tick().

◆ IsSpring

bool Date.IsSpring
get

Definition at line 155 of file Date.cs.

156 {
157 get
158 {
159 if (month >= 3)
160 {
161 return month <= 5;
162 }
163 return false;
164 }
165 }

◆ IsSummer

bool Date.IsSummer
get

Definition at line 167 of file Date.cs.

168 {
169 get
170 {
171 if (month >= 6)
172 {
173 return month <= 8;
174 }
175 return false;
176 }
177 }

◆ IsWinter

bool Date.IsWinter
get

Definition at line 191 of file Date.cs.

192 {
193 get
194 {
195 if (month < 12)
196 {
197 return month <= 2;
198 }
199 return true;
200 }
201 }

Referenced by GrowSystem.CanGrow(), Zone.GrowPlants(), and Zone.Simulate().

◆ min

int Date.min
getset

Definition at line 85 of file Date.cs.

86 {
87 get
88 {
89 return raw[4];
90 }
91 set
92 {
93 raw[4] = value;
94 }
95 }

Referenced by Copy(), GetRaw(), GetRawReal(), GetText(), MinToDayAndHour(), ToDate(), and Scene.UpdateTimeRatio().

◆ month

int Date.month
getset

Definition at line 49 of file Date.cs.

50 {
51 get
52 {
53 return raw[1];
54 }
55 set
56 {
57 raw[1] = value;
58 }
59 }

Referenced by AddMonth(), GameDate.AdvanceDay(), Copy(), GetRaw(), GetRawDay(), GetRawReal(), GetText(), TraitFoodEggFertilized.MakeBaby(), ContentHomeReport.RefreshInfo(), UIHomeInfo.RefreshInfo(), WindowChara.RefreshNote(), and ToDate().

◆ NameMonth

string Date.NameMonth
get

Definition at line 147 of file Date.cs.

◆ NameMonthShort

string Date.NameMonthShort
get

Definition at line 151 of file Date.cs.

Referenced by GetText().

◆ NameSeason

string Date.NameSeason
get

Definition at line 149 of file Date.cs.

◆ NameTime

string Date.NameTime
get

Definition at line 153 of file Date.cs.

◆ periodOfDay

PeriodOfDay Date.periodOfDay
get

Definition at line 127 of file Date.cs.

128 {
129 get
130 {
131 if (hour >= 5 && hour <= 6)
132 {
133 return PeriodOfDay.Dawn;
134 }
135 if (hour >= 7 && hour <= 17)
136 {
137 return PeriodOfDay.Day;
138 }
139 if (hour >= 18 && hour <= 19)
140 {
141 return PeriodOfDay.Dusk;
142 }
143 return PeriodOfDay.Night;
144 }
145 }
PeriodOfDay
Definition: PeriodOfDay.cs:2

Referenced by WidgetDate._Refresh(), and Card.GetLightRadius().

◆ sec

int Date.sec
getset

Definition at line 97 of file Date.cs.

98 {
99 get
100 {
101 return raw[5];
102 }
103 set
104 {
105 raw[5] = value;
106 }
107 }

Referenced by Copy(), GetText(), and SecToDate().

◆ year

int Date.year
getset

The documentation for this class was generated from the following file: