Elin Decompiled Documentation EA 23.243 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 (int _a, int start, int step, int rate=75)
 
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 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 229 of file Date.cs.

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

References AddMonth(), and day.

Referenced by AddHour().

◆ AddHour()

void Date.AddHour ( int  a)
inline

Definition at line 219 of file Date.cs.

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

References AddDay(), and hour.

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

◆ AddMonth()

void Date.AddMonth ( int  a)
inline

Definition at line 239 of file Date.cs.

240 {
241 month += a;
242 while (month > 12)
243 {
244 month -= 12;
245 year++;
246 }
247 }
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 201 of file Date.cs.

202 {
203 return new Date
204 {
205 year = year,
206 month = month,
207 day = day,
208 hour = hour,
209 min = min,
210 sec = sec
211 };
212 }
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 385 of file Date.cs.

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

References raw.

Referenced by ToDate().

◆ GetElapsedHour()

int Date.GetElapsedHour ( int  rawDate)
inline

Definition at line 356 of file Date.cs.

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

References GetRaw().

Referenced by Player.MoveZone().

◆ GetElapsedMins()

int Date.GetElapsedMins ( int  rawDate)
inline

Definition at line 351 of file Date.cs.

352 {
353 return GetRaw() - rawDate;
354 }

References GetRaw().

Referenced by Weather.GetTimeSinceLastRain().

◆ GetRaw()

int Date.GetRaw ( int  offsetHours = 0)
inline

Definition at line 326 of file Date.cs.

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

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.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 331 of file Date.cs.

332 {
333 return day * 1440 + month * 43200 + year * 518400;
334 }

References day, month, and year.

◆ GetRawReal()

int Date.GetRawReal ( int  offsetHours = 0)
inline

Definition at line 321 of file Date.cs.

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

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 346 of file Date.cs.

347 {
348 return rawDeadLine - GetRaw();
349 }

References GetRaw().

◆ GetText() [1/3]

static string Date.GetText ( int  hour)
inlinestatic

Definition at line 295 of file Date.cs.

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

References hour, and ToString().

◆ GetText() [2/3]

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

Definition at line 290 of file Date.cs.

291 {
292 return ToDate(raw).GetText(format);
293 }
static Date ToDate(int raw)
Definition: Date.cs:397
string GetText(TextFormat format)
Definition: Date.cs:249

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

◆ GetText() [3/3]

string Date.GetText ( TextFormat  format)
inline

Definition at line 249 of file Date.cs.

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

References day, Lang.Get(), hour, min, month, NameMonth, 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 308 of file Date.cs.

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

References hour.

Referenced by LayerTravel.Refresh().

◆ IsExpired()

◆ MinToDayAndHour()

static string Date.MinToDayAndHour ( int  min)
inlinestatic

Definition at line 370 of file Date.cs.

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

References min.

◆ SecToDate()

static string Date.SecToDate ( int  sec)
inlinestatic

Definition at line 365 of file Date.cs.

366 {
367 return sec / 60 / 60 + "時間 " + sec / 60 % 60 + "分 " + sec % 60 + "秒";
368 }

References sec.

◆ ToDate()

static Date Date.ToDate ( int  raw)
inlinestatic

Definition at line 397 of file Date.cs.

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

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

Referenced by GetText(), and LayerShippingResult.Show().

◆ ToString()

override string Date.ToString ( )
inline

Definition at line 214 of file Date.cs.

215 {
216 return GetText(TextFormat.Log);
217 }

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

int Date.day
getset

◆ 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 177 of file Date.cs.

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

◆ 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 153 of file Date.cs.

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

◆ IsSummer

bool Date.IsSummer
get

Definition at line 165 of file Date.cs.

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

◆ IsWinter

bool Date.IsWinter
get

Definition at line 189 of file Date.cs.

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

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(), Copy(), GetRaw(), GetRawDay(), GetRawReal(), GetText(), ContentHomeReport.RefreshInfo(), UIHomeInfo.RefreshInfo(), and ToDate().

◆ NameMonth

string Date.NameMonth
get

Definition at line 147 of file Date.cs.

Referenced by GetText().

◆ NameMonthShort

string Date.NameMonthShort
get

Definition at line 149 of file Date.cs.

◆ NameTime

string Date.NameTime
get

Definition at line 151 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

Definition at line 37 of file Date.cs.

38 {
39 get
40 {
41 return raw[0];
42 }
43 set
44 {
45 raw[0] = value;
46 }
47 }

Referenced by AddMonth(), Copy(), Biography.GetAge(), GetRaw(), GetRawDay(), GetRawReal(), GetText(), LayerNewspaper.OnInit(), ContentHomeReport.RefreshInfo(), UIHomeInfo.RefreshInfo(), LayerShippingResult.Show(), and ToDate().


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