[2] | 1 | /* |
---|
[44] | 2 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
---|
[2] | 3 | * |
---|
[44] | 4 | * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> |
---|
| 5 | * |
---|
[2] | 6 | * This program is free software; you can redistribute it and/or modify |
---|
| 7 | * it under the terms of the GNU General Public License as published by |
---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 9 | * (at your option) any later version. |
---|
| 10 | * |
---|
| 11 | * This program is distributed in the hope that it will be useful, |
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
[44] | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
[2] | 14 | * GNU General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU General Public License |
---|
| 17 | * along with this program; if not, write to the Free Software |
---|
[44] | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
[2] | 19 | */ |
---|
| 20 | |
---|
| 21 | /// \addtogroup world |
---|
| 22 | /// @{ |
---|
| 23 | /// \file |
---|
| 24 | |
---|
| 25 | #ifndef __WEATHER_H |
---|
| 26 | #define __WEATHER_H |
---|
| 27 | |
---|
| 28 | #include "Common.h" |
---|
| 29 | #include "SharedDefines.h" |
---|
| 30 | #include "Timer.h" |
---|
| 31 | |
---|
| 32 | class Player; |
---|
| 33 | |
---|
| 34 | enum WeatherState |
---|
| 35 | { |
---|
| 36 | WEATHER_STATE_FINE = 0, |
---|
| 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 | }; |
---|
| 49 | |
---|
| 50 | struct WeatherZoneChances; |
---|
| 51 | |
---|
| 52 | /// Weather for one zone |
---|
| 53 | class Weather |
---|
| 54 | { |
---|
| 55 | public: |
---|
| 56 | Weather(uint32 zone, WeatherZoneChances const* weatherChances); |
---|
| 57 | ~Weather() { }; |
---|
| 58 | bool ReGenerate(); |
---|
| 59 | bool UpdateWeather(); |
---|
| 60 | void SendWeatherUpdateToPlayer(Player *player); |
---|
| 61 | static void SendFineWeatherUpdateToPlayer(Player *player); |
---|
| 62 | void SetWeather(WeatherType type, float grade); |
---|
| 63 | /// For which zone is this weather? |
---|
| 64 | uint32 GetZone() { return m_zone; }; |
---|
| 65 | bool Update(time_t diff); |
---|
| 66 | private: |
---|
| 67 | WeatherState GetWeatherState() const; |
---|
| 68 | uint32 m_zone; |
---|
| 69 | WeatherType m_type; |
---|
| 70 | float m_grade; |
---|
| 71 | IntervalTimer m_timer; |
---|
| 72 | WeatherZoneChances const* m_weatherChances; |
---|
| 73 | }; |
---|
| 74 | #endif |
---|