mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
Weather system changed to that of the previous cores.
Weather system changed to that of the previous cores. This is part of the current build errors fixes.
This commit is contained in:
parent
9e94234bdf
commit
165cfba9c4
28 changed files with 1650 additions and 859 deletions
|
|
@ -4849,33 +4849,29 @@ bool ChatHandler::HandleChangeWeatherCommand(char* args)
|
|||
if (!ExtractUInt32(&args, type))
|
||||
return false;
|
||||
|
||||
// 0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
|
||||
if (type > 3)
|
||||
// see enum WeatherType
|
||||
if (!Weather::IsValidWeatherType(type))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
float grade;
|
||||
if (!ExtractFloat(&args, grade))
|
||||
return false;
|
||||
|
||||
// 0 to 1, sending -1 is instand good weather
|
||||
// 0 to 1, sending -1 is instant good weather
|
||||
if (grade < 0.0f || grade > 1.0f)
|
||||
return false;
|
||||
|
||||
Player* player = m_session->GetPlayer();
|
||||
uint32 zoneid = player->GetZoneId();
|
||||
|
||||
Weather* wth = sWorld.FindWeather(zoneid);
|
||||
|
||||
if (!wth)
|
||||
wth = sWorld.AddWeather(zoneid);
|
||||
if (!wth)
|
||||
uint32 zoneId = player->GetZoneId();
|
||||
if (!sWeatherMgr.GetWeatherChances(zoneId))
|
||||
{
|
||||
SendSysMessage(LANG_NO_WEATHER);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
wth->SetWeather(WeatherType(type), grade);
|
||||
player->GetMap()->SetWeather(zoneId, (WeatherType)type, grade, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue