Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Weather Class Reference
Inheritance diagram for Weather:
EClass

Classes

class  Forecast
 
class  WeatherForecast
 

Public Types

enum  Condition {
  Fine , Cloudy , Rain , RainHeavy ,
  Snow , SnowHeavy , Ether , Blossom ,
  None
}
 

Public Member Functions

string GetName ()
 
string GetName (Condition condition)
 
void RefreshWeather ()
 
void OnChangeHour ()
 
Forecast GetForecast (Date date, Condition current)
 
List< WeatherForecastGetWeatherForecast ()
 
void RefreshForecasts ()
 
long GetTimeSinceLastRain ()
 
void SetRandomCondition ()
 
void SetConditionFromForecast (bool silent=false)
 
void SetCondition (Condition condition, int _duration=20, bool silent=false)
 

Public Attributes

Condition _currentCondition
 
int duration = 8
 
int lastRain
 
List< Forecastforecasts = new List<Forecast>()
 

Properties

Condition CurrentCondition [get]
 
Season season [get]
 
bool IsHazard [get]
 
bool IsFineOrCloudy [get]
 
bool IsRaining [get]
 
bool IsSnowing [get]
 
bool IsBlossom [get]
 
bool IsEther [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]
 

Static Private Attributes

const int maxForecasts = 10
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
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)
 
- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 5 of file Weather.cs.

Member Enumeration Documentation

◆ Condition

Enumerator
Fine 
Cloudy 
Rain 
RainHeavy 
Snow 
SnowHeavy 
Ether 
Blossom 
None 

Definition at line 15 of file Weather.cs.

Member Function Documentation

◆ GetForecast()

Forecast Weather.GetForecast ( Date  date,
Condition  current 
)
inline

Definition at line 206 of file Weather.cs.

207 {
208 Forecast forecast = new Forecast();
209 forecast.condition = ((EClass.rnd(4) == 0) ? season.GetRandomWeather(date, current) : Condition.Fine);
210 forecast.duration = EClass.rnd(24) + 10;
211 date.AddHour(forecast.duration);
212 return forecast;
213 }
void AddHour(int a)
Definition: Date.cs:215
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:50
Weather.Condition GetRandomWeather(Date date, Weather.Condition current)
Definition: Season.cs:64
Season season
Definition: Weather.cs:90

References Date.AddHour(), Weather.Forecast.duration, Season.GetRandomWeather(), EClass.rnd(), and season.

Referenced by RefreshForecasts().

◆ GetName() [1/2]

string Weather.GetName ( )
inline

Definition at line 158 of file Weather.cs.

159 {
161 }
string GetName()
Definition: Weather.cs:158
Condition CurrentCondition
Definition: Weather.cs:79

References CurrentCondition, and GetName().

Referenced by WidgetDate._Refresh(), and GetName().

◆ GetName() [2/2]

string Weather.GetName ( Condition  condition)
inline

Definition at line 163 of file Weather.cs.

164 {
165 return ("weather" + condition).lang();
166 }

◆ GetTimeSinceLastRain()

long Weather.GetTimeSinceLastRain ( )
inline

Definition at line 286 of file Weather.cs.

287 {
288 if (CurrentCondition == Condition.Rain || CurrentCondition == Condition.RainHeavy)
289 {
290 return 0L;
291 }
293 }
int GetElapsedMins(int rawDate)
Definition: Date.cs:347
static World world
Definition: EClass.cs:40
int lastRain
Definition: Weather.cs:73
GameDate date
Definition: World.cs:6

References CurrentCondition, World.date, Date.GetElapsedMins(), lastRain, and EClass.world.

◆ GetWeatherForecast()

List< WeatherForecast > Weather.GetWeatherForecast ( )
inline

Definition at line 215 of file Weather.cs.

216 {
218 List<WeatherForecast> list = new List<WeatherForecast>();
219 Date date = EClass.world.date.Copy();
220 WeatherForecast weatherForecast = new WeatherForecast
221 {
222 date = date.Copy()
223 };
224 list.Add(weatherForecast);
225 Forecast forecast = new Forecast
226 {
227 condition = _currentCondition,
229 };
230 int num = forecast.duration;
231 int num2 = -1;
232 for (int i = 0; i < 10000; i++)
233 {
234 num--;
235 weatherForecast.Add(forecast.condition, 1);
236 if (num < 0)
237 {
238 num2++;
239 if (forecasts.Count <= num2)
240 {
241 list.Remove(weatherForecast);
242 break;
243 }
244 forecast = forecasts[num2];
245 num = forecast.duration;
246 }
247 date.AddHour(1);
248 if (date.day != weatherForecast.date.day)
249 {
250 weatherForecast.Finish();
251 weatherForecast = new WeatherForecast
252 {
253 date = date.Copy()
254 };
255 list.Add(weatherForecast);
256 }
257 }
258 return list;
259 }
Definition: Date.cs:4
Date Copy()
Definition: Date.cs:197
int day
Definition: Date.cs:62
Condition _currentCondition
Definition: Weather.cs:67
int duration
Definition: Weather.cs:70
void RefreshForecasts()
Definition: Weather.cs:261
List< Forecast > forecasts
Definition: Weather.cs:76

References _currentCondition, Weather.WeatherForecast.Add(), Date.AddHour(), Weather.Forecast.condition, Date.Copy(), Weather.WeatherForecast.date, World.date, Date.day, Weather.Forecast.duration, duration, Weather.WeatherForecast.Finish(), forecasts, RefreshForecasts(), and EClass.world.

Referenced by LayerNewspaper.RefreshWeather().

◆ OnChangeHour()

void Weather.OnChangeHour ( )
inline

Definition at line 197 of file Weather.cs.

198 {
199 duration--;
200 if (duration < 0)
201 {
203 }
204 }
void SetConditionFromForecast(bool silent=false)
Definition: Weather.cs:300

References duration, and SetConditionFromForecast().

Referenced by GameDate.AdvanceHour().

◆ RefreshForecasts()

void Weather.RefreshForecasts ( )
inline

Definition at line 261 of file Weather.cs.

262 {
263 if (forecasts.Count >= 10)
264 {
265 return;
266 }
267 Date date = EClass.world.date.Copy();
268 Condition current = Condition.Fine;
269 for (int i = 0; i < 10; i++)
270 {
271 if (forecasts.Count > i)
272 {
273 Forecast forecast = forecasts[i];
274 date.AddHour(forecast.duration);
275 current = forecast.condition;
276 }
277 else
278 {
279 Forecast forecast2 = GetForecast(date, current);
280 forecasts.Add(forecast2);
281 current = forecast2.condition;
282 }
283 }
284 }
Forecast GetForecast(Date date, Condition current)
Definition: Weather.cs:206

References Date.AddHour(), Weather.Forecast.condition, Date.Copy(), World.date, Weather.Forecast.duration, forecasts, GetForecast(), and EClass.world.

Referenced by GetWeatherForecast(), and SetConditionFromForecast().

◆ RefreshWeather()

void Weather.RefreshWeather ( )
inline

Definition at line 168 of file Weather.cs.

169 {
170 if (EClass._map.IsIndoor)
171 {
172 return;
173 }
174 bool flag = EClass._zone.IsSnowCovered;
175 if (EClass._zone is Region)
176 {
178 flag = elomap.GetTileInfo(EClass.pc.pos.x + elomap.minX, EClass.pc.pos.z + elomap.minY)?.IsSnow ?? false;
180 {
181 flag = true;
182 }
183 }
184 if (IsSnowing)
185 {
186 if (!flag)
187 {
188 _currentCondition = ((_currentCondition == Condition.Snow) ? Condition.Rain : Condition.RainHeavy);
189 }
190 }
191 else if (IsRaining && flag)
192 {
193 _currentCondition = ((_currentCondition == Condition.Rain) ? Condition.Snow : Condition.SnowHeavy);
194 }
195 }
Point pos
Definition: Card.cs:55
static Scene scene
Definition: EClass.cs:30
static Zone _zone
Definition: EClass.cs:20
static Map _map
Definition: EClass.cs:18
static Chara pc
Definition: EClass.cs:14
EloMap elomap
Definition: EloMapActor.cs:7
bool IsSnow
Definition: EloMap.cs:55
Definition: EloMap.cs:8
int minX
Definition: EloMap.cs:112
int minY
Definition: EloMap.cs:114
TileInfo GetTileInfo(int gx, int gy)
Definition: EloMap.cs:287
bool IsIndoor
Definition: Map.cs:131
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
Definition: Region.cs:7
EloMapActor elomapActor
Definition: Scene.cs:97
bool isWinter
Definition: Season.cs:53
virtual bool IsSnowCovered
Definition: Spatial.cs:531
bool IsSnowing
Definition: Weather.cs:129
bool IsRaining
Definition: Weather.cs:117
Season season
Definition: World.cs:9

References _currentCondition, EClass._map, EClass._zone, EloMapActor.elomap, Scene.elomapActor, EloMap.GetTileInfo(), Map.IsIndoor, IsRaining, EloMap.TileInfo.IsSnow, Spatial.IsSnowCovered, IsSnowing, Season.isWinter, EloMap.minX, EloMap.minY, EClass.pc, Card.pos, EClass.scene, World.season, EClass.world, Point.x, and Point.z.

Referenced by Scene.Init(), GameScreenElona.RefreshWeather(), and SetCondition().

◆ SetCondition()

void Weather.SetCondition ( Condition  condition,
int  _duration = 20,
bool  silent = false 
)
inline

Definition at line 308 of file Weather.cs.

309 {
310 if (condition == Condition.Fine)
311 {
312 foreach (Chara member in EClass.pc.party.members)
313 {
314 if (member.HasElement(1558) && EClass.rnd(4) == 0)
315 {
316 condition = Condition.Rain;
317 Msg.Say("drawRain", member);
318 break;
319 }
320 }
321 }
323 {
324 switch (condition)
325 {
326 case Condition.Rain:
327 condition = Condition.Snow;
328 break;
329 case Condition.RainHeavy:
330 condition = Condition.SnowHeavy;
331 break;
332 }
333 }
335 {
336 switch (condition)
337 {
338 case Condition.Snow:
339 condition = Condition.Rain;
340 break;
341 case Condition.SnowHeavy:
342 condition = Condition.RainHeavy;
343 break;
344 }
345 }
346 if (_currentCondition == Condition.Rain || _currentCondition == Condition.RainHeavy)
347 {
349 }
350 duration = _duration;
351 if (condition != _currentCondition)
352 {
353 _currentCondition = condition;
355 Msg.Say("weather_" + condition);
356 if (IsRaining)
357 {
359 }
361 }
362 }
bool HasElement(int ele, int req=1)
Definition: Card.cs:5214
Definition: Chara.cs:10
Party party
Definition: Chara.cs:43
BaseGameScreen screen
Definition: Core.cs:67
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
static Core core
Definition: EClass.cs:6
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
List< Chara > members
Definition: Party.cs:18
virtual bool IsSnowZone
Definition: Spatial.cs:528
void RefreshWeather()
Definition: Weather.cs:168
void RainWater()
Definition: Zone.cs:3115

References _currentCondition, EClass._map, EClass._zone, EClass.core, World.date, duration, Date.GetRaw(), Card.HasElement(), Map.IsIndoor, IsRaining, Spatial.IsSnowZone, Season.isWinter, lastRain, Party.members, Chara.party, EClass.pc, Zone.RainWater(), BaseGameScreen.RefreshSky(), RefreshWeather(), EClass.rnd(), Msg.Say(), Core.screen, World.season, and EClass.world.

Referenced by World.ModEther(), WidgetArtTool.OnActivate(), SetConditionFromForecast(), SetRandomCondition(), and CoreDebug.UpdateInput().

◆ SetConditionFromForecast()

void Weather.SetConditionFromForecast ( bool  silent = false)
inline

Definition at line 300 of file Weather.cs.

301 {
303 Forecast forecast = forecasts[0];
304 SetCondition(forecast.condition, forecast.duration, silent);
305 forecasts.RemoveAt(0);
306 }
void SetCondition(Condition condition, int _duration=20, bool silent=false)
Definition: Weather.cs:308

References Weather.Forecast.condition, Weather.Forecast.duration, forecasts, RefreshForecasts(), and SetCondition().

Referenced by OnChangeHour().

◆ SetRandomCondition()

void Weather.SetRandomCondition ( )
inline

Definition at line 295 of file Weather.cs.

296 {
297 SetCondition(Util.RandomEnum<Condition>());
298 }
Definition: Util.cs:10

References SetCondition(), and Util.

Member Data Documentation

◆ _currentCondition

Condition Weather._currentCondition

Definition at line 67 of file Weather.cs.

Referenced by GetWeatherForecast(), RefreshWeather(), and SetCondition().

◆ duration

int Weather.duration = 8

Definition at line 70 of file Weather.cs.

Referenced by GetWeatherForecast(), OnChangeHour(), and SetCondition().

◆ forecasts

List<Forecast> Weather.forecasts = new List<Forecast>()

Definition at line 76 of file Weather.cs.

Referenced by GetWeatherForecast(), RefreshForecasts(), and SetConditionFromForecast().

◆ lastRain

int Weather.lastRain

Definition at line 73 of file Weather.cs.

Referenced by GetTimeSinceLastRain(), and SetCondition().

◆ maxForecasts

const int Weather.maxForecasts = 10
staticprivate

Definition at line 64 of file Weather.cs.

Property Documentation

◆ CurrentCondition

Condition Weather.CurrentCondition
get

◆ IsBlossom

bool Weather.IsBlossom
get

Definition at line 140 of file Weather.cs.

141 {
142 get
143 {
144 if (CurrentCondition != Condition.Blossom)
145 {
146 if (IsFineOrCloudy)
147 {
148 return EClass._map.config.blossom;
149 }
150 return false;
151 }
152 return true;
153 }
154 }
bool blossom
Definition: MapConfig.cs:41
bool IsFineOrCloudy
Definition: Weather.cs:105

Referenced by BaseGameScreen.RefreshWeather().

◆ IsEther

bool Weather.IsEther
get

Definition at line 156 of file Weather.cs.

Referenced by BaseGameScreen.RefreshWeather(), and GameScreenElona.RefreshWeather().

◆ IsFineOrCloudy

bool Weather.IsFineOrCloudy
get

Definition at line 104 of file Weather.cs.

105 {
106 get
107 {
108 if (CurrentCondition != 0)
109 {
110 return CurrentCondition == Condition.Cloudy;
111 }
112 return true;
113 }
114 }

◆ IsHazard

bool Weather.IsHazard
get

Definition at line 92 of file Weather.cs.

93 {
94 get
95 {
96 if (CurrentCondition != Condition.Rain && CurrentCondition != Condition.RainHeavy && CurrentCondition != Condition.Snow && CurrentCondition != Condition.SnowHeavy)
97 {
98 return CurrentCondition == Condition.Ether;
99 }
100 return true;
101 }
102 }

Referenced by TraitGenerator.OnSimulateHour().

◆ IsRaining

bool Weather.IsRaining
get

◆ IsSnowing

bool Weather.IsSnowing
get

Definition at line 128 of file Weather.cs.

129 {
130 get
131 {
132 if (CurrentCondition != Condition.Snow)
133 {
134 return CurrentCondition == Condition.SnowHeavy;
135 }
136 return true;
137 }
138 }

Referenced by RefreshWeather().

◆ season

Season Weather.season
get

Definition at line 90 of file Weather.cs.

Referenced by GetForecast().


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