Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
Weather.h
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
9
10
#ifndef SF_WEATHER_H
11
#define SF_WEATHER_H
12
13
#include "
Common.h
"
14
#include "
SharedDefines.h
"
15
#include "
Timer.h
"
16
17
class
Player
;
18
19
#define WEATHER_SEASONS 4
20
struct
WeatherSeasonChances
21
{
22
uint32
rainChance
;
23
uint32
snowChance
;
24
uint32
stormChance
;
25
};
26
27
struct
WeatherData
28
{
29
WeatherSeasonChances
data
[
WEATHER_SEASONS
];
30
uint32
ScriptId
;
31
};
32
33
enum
WeatherState
34
{
35
WEATHER_STATE_FINE
= 0,
36
WEATHER_STATE_FOG
= 1,
// Used in some instance encounters.
37
WEATHER_STATE_LIGHT_RAIN
= 3,
38
WEATHER_STATE_MEDIUM_RAIN
= 4,
39
WEATHER_STATE_HEAVY_RAIN
= 5,
40
WEATHER_STATE_LIGHT_SNOW
= 6,
41
WEATHER_STATE_MEDIUM_SNOW
= 7,
42
WEATHER_STATE_HEAVY_SNOW
= 8,
43
WEATHER_STATE_LIGHT_SANDSTORM
= 22,
44
WEATHER_STATE_MEDIUM_SANDSTORM
= 41,
45
WEATHER_STATE_HEAVY_SANDSTORM
= 42,
46
WEATHER_STATE_THUNDERS
= 86,
47
WEATHER_STATE_BLACKRAIN
= 90,
48
WEATHER_STATE_BLACKSNOW
= 106
49
};
50
52
class
Weather
53
{
54
public
:
55
Weather
(
uint32
zone,
WeatherData
const
* weatherChances);
56
~Weather
() { };
57
58
bool
Update
(
uint32
diff);
59
bool
ReGenerate
();
60
bool
UpdateWeather
();
61
62
void
SendWeatherUpdateToPlayer
(
Player
* player);
63
void
SetWeather
(
WeatherType
type,
float
grade);
64
66
uint32
GetZone
()
const
{
return
m_zone
; };
67
uint32
GetScriptId
()
const
{
return
m_weatherChances
->ScriptId; }
68
69
private
:
70
WeatherState
GetWeatherState
()
const
;
71
uint32
m_zone
;
72
WeatherType
m_type
;
73
float
m_grade
;
74
IntervalTimer
m_timer
;
75
WeatherData
const
*
m_weatherChances
;
76
};
77
#endif
Common.h
uint32
std::uint32_t uint32
Definition
Define.h:77
SharedDefines.h
WeatherType
WeatherType
Definition
SharedDefines.h:3650
Timer.h
Player
Definition
Player.h:1289
Weather::GetScriptId
uint32 GetScriptId() const
Definition
Weather.h:67
Weather::m_type
WeatherType m_type
Definition
Weather.h:72
Weather::m_zone
uint32 m_zone
Definition
Weather.h:71
WeatherState
WeatherState
Definition
Weather.h:34
Weather::SetWeather
void SetWeather(WeatherType type, float grade)
Set the weather.
Definition
Weather.cpp:267
WeatherSeasonChances::snowChance
uint32 snowChance
Definition
Weather.h:23
WeatherData::data
WeatherSeasonChances data[WEATHER_SEASONS]
Definition
Weather.h:29
Weather::m_grade
float m_grade
Definition
Weather.h:73
Weather::GetZone
uint32 GetZone() const
For which zone is this weather?
Definition
Weather.h:66
WEATHER_SEASONS
#define WEATHER_SEASONS
Definition
Weather.h:19
Weather::~Weather
~Weather()
Definition
Weather.h:56
WeatherSeasonChances::rainChance
uint32 rainChance
Definition
Weather.h:22
WeatherData::ScriptId
uint32 ScriptId
Definition
Weather.h:30
WeatherSeasonChances::stormChance
uint32 stormChance
Definition
Weather.h:24
Weather::UpdateWeather
bool UpdateWeather()
Send the new weather to all players in the zone.
Definition
Weather.cpp:194
Weather::m_timer
IntervalTimer m_timer
Definition
Weather.h:74
Weather::ReGenerate
bool ReGenerate()
Calculate the new weather.
Definition
Weather.cpp:59
Weather::m_weatherChances
WeatherData const * m_weatherChances
Definition
Weather.h:75
Weather::GetWeatherState
WeatherState GetWeatherState() const
Get the sound number associated with the current weather.
Definition
Weather.cpp:278
Weather::Weather
Weather(uint32 zone, WeatherData const *weatherChances)
Create the Weather object.
Definition
Weather.cpp:23
Weather::Update
bool Update(uint32 diff)
Launch a weather update.
Definition
Weather.cpp:34
Weather::SendWeatherUpdateToPlayer
void SendWeatherUpdateToPlayer(Player *player)
Definition
Weather.cpp:183
WEATHER_STATE_THUNDERS
@ WEATHER_STATE_THUNDERS
Definition
Weather.h:46
WEATHER_STATE_HEAVY_RAIN
@ WEATHER_STATE_HEAVY_RAIN
Definition
Weather.h:39
WEATHER_STATE_HEAVY_SANDSTORM
@ WEATHER_STATE_HEAVY_SANDSTORM
Definition
Weather.h:45
WEATHER_STATE_MEDIUM_SNOW
@ WEATHER_STATE_MEDIUM_SNOW
Definition
Weather.h:41
WEATHER_STATE_MEDIUM_RAIN
@ WEATHER_STATE_MEDIUM_RAIN
Definition
Weather.h:38
WEATHER_STATE_MEDIUM_SANDSTORM
@ WEATHER_STATE_MEDIUM_SANDSTORM
Definition
Weather.h:44
WEATHER_STATE_BLACKSNOW
@ WEATHER_STATE_BLACKSNOW
Definition
Weather.h:48
WEATHER_STATE_FINE
@ WEATHER_STATE_FINE
Definition
Weather.h:35
WEATHER_STATE_LIGHT_SNOW
@ WEATHER_STATE_LIGHT_SNOW
Definition
Weather.h:40
WEATHER_STATE_BLACKRAIN
@ WEATHER_STATE_BLACKRAIN
Definition
Weather.h:47
WEATHER_STATE_HEAVY_SNOW
@ WEATHER_STATE_HEAVY_SNOW
Definition
Weather.h:42
WEATHER_STATE_LIGHT_SANDSTORM
@ WEATHER_STATE_LIGHT_SANDSTORM
Definition
Weather.h:43
WEATHER_STATE_FOG
@ WEATHER_STATE_FOG
Definition
Weather.h:36
WEATHER_STATE_LIGHT_RAIN
@ WEATHER_STATE_LIGHT_RAIN
Definition
Weather.h:37
IntervalTimer
Definition
Timer.h:28
WeatherData
Definition
Weather.h:28
WeatherSeasonChances
Definition
Weather.h:21
src
server
game
Weather
Weather.h
Generated on
for Project SkyFire Core by
1.17.0