2 * Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "Policies/Singleton.h"
24 #include "SharedDefines.h"
52 enum EnviromentalDamage
68 WorldSession
* FindSession(uint32 id
) const;
69 void AddSession(WorldSession
*s
);
70 void RemoveSession(uint32 id
);
71 uint32
GetSessionCount() const { return m_sessions
.size(); }
72 Player
* FindPlayerInZone(uint32 zone
);
74 Weather
* FindWeather(uint32 id
) const;
75 void AddWeather(Weather
*w
);
76 void RemoveWeather(uint32 id
);
78 uint32
GetPlayerLimit() const { return m_playerLimit
; }
79 void SetPlayerLimit(uint32 limit
) { m_playerLimit
= limit
; }
81 bool getAllowMovement() const { return m_allowMovement
; }
82 void SetAllowMovement(bool allow
) { m_allowMovement
= allow
; }
84 void SetMotd(const char *motd
) { m_motd
= motd
; }
85 const char* GetMotd() const { return m_motd
.c_str(); }
87 time_t GetGameTime() const { return m_gameTime
; }
89 void SetInitialWorldSettings();
91 void SendWorldText(const char *text
, WorldSession
*self
= 0);
92 void SendGlobalMessage(WorldPacket
*packet
, WorldSession
*self
= 0);
94 void Update(time_t diff
);
96 void setRate(int index
,float value
)
98 if((index
>=0)&&(index
<MAX_RATES
))
99 regen_values
[index
]=value
;
102 float getRate(int index
)
104 if((index
>=0)&&(index
<MAX_RATES
))
105 return regen_values
[index
];
112 time_t _UpdateGameTime()
115 time_t thisTime
= time(NULL
);
116 m_gameTime
+= thisTime
- m_lastTick
;
117 m_lastTick
= thisTime
;
124 IntervalTimer m_timers
[WUPDATE_COUNT
];
126 typedef HM_NAMESPACE::hash_map
<uint32
, Weather
*> WeatherMap
;
127 WeatherMap m_weathers
;
128 typedef HM_NAMESPACE::hash_map
<uint32
, WorldSession
*> SessionMap
;
129 SessionMap m_sessions
;
130 float regen_values
[5];
131 uint32 m_playerLimit
;
132 bool m_allowMovement
;
138 time_t m_nextThinkTime
;
141 #define sWorld MaNGOS::Singleton<World>::Instance()