Core/Conditions: Implemented missing PlayerCondition columns - time and weather
This commit is contained in:
@@ -2855,7 +2855,19 @@ bool ConditionMgr::IsPlayerMeetingCondition(Player const* player, PlayerConditio
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: time condition
|
||||
if (condition->Time[0])
|
||||
{
|
||||
ByteBuffer unpacker;
|
||||
unpacker << condition->Time[0];
|
||||
time_t from = unpacker.ReadPackedTime();
|
||||
unpacker.rpos(0);
|
||||
unpacker.wpos(0);
|
||||
unpacker << condition->Time[1];
|
||||
time_t to = unpacker.ReadPackedTime();
|
||||
|
||||
if (GameTime::GetGameTime() < from || GameTime::GetGameTime() > to)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (condition->WorldStateExpressionID)
|
||||
{
|
||||
@@ -2867,7 +2879,9 @@ bool ConditionMgr::IsPlayerMeetingCondition(Player const* player, PlayerConditio
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: weather condition
|
||||
if (condition->WeatherID)
|
||||
if (player->GetMap()->GetZoneWeather(player->GetZoneId()) != WeatherState(condition->WeatherID))
|
||||
return false;
|
||||
|
||||
if (condition->Achievement[0])
|
||||
{
|
||||
|
||||
@@ -4847,6 +4847,21 @@ Weather* Map::GetOrGenerateZoneDefaultWeather(uint32 zoneId)
|
||||
return info.DefaultWeather.get();
|
||||
}
|
||||
|
||||
WeatherState Map::GetZoneWeather(uint32 zoneId) const
|
||||
{
|
||||
ZoneDynamicInfo const* zoneDynamicInfo = Trinity::Containers::MapGetValuePtr(_zoneDynamicInfo, zoneId);
|
||||
if (zoneDynamicInfo)
|
||||
{
|
||||
if (WeatherState weatherId = zoneDynamicInfo->WeatherId)
|
||||
return weatherId;
|
||||
|
||||
if (zoneDynamicInfo->DefaultWeather)
|
||||
return zoneDynamicInfo->DefaultWeather->GetWeatherState();
|
||||
}
|
||||
|
||||
return WEATHER_STATE_FINE;
|
||||
}
|
||||
|
||||
void Map::SetZoneWeather(uint32 zoneId, WeatherState weatherId, float weatherGrade)
|
||||
{
|
||||
ZoneDynamicInfo& info = _zoneDynamicInfo[zoneId];
|
||||
|
||||
@@ -552,6 +552,7 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
|
||||
|
||||
void SetZoneMusic(uint32 zoneId, uint32 musicId);
|
||||
Weather* GetOrGenerateZoneDefaultWeather(uint32 zoneId);
|
||||
WeatherState GetZoneWeather(uint32 zoneId) const;
|
||||
void SetZoneWeather(uint32 zoneId, WeatherState weatherId, float weatherGrade);
|
||||
void SetZoneOverrideLight(uint32 zoneId, uint32 lightId, uint32 fadeInTime);
|
||||
|
||||
|
||||
@@ -76,13 +76,12 @@ class TC_GAME_API Weather
|
||||
static void SendFineWeatherUpdateToPlayer(Player* player);
|
||||
void SetWeather(WeatherType type, float grade);
|
||||
|
||||
WeatherState GetWeatherState() const;
|
||||
/// For which zone is this weather?
|
||||
uint32 GetZone() const { return m_zone; };
|
||||
uint32 GetScriptId() const { return m_weatherChances->ScriptId; }
|
||||
|
||||
private:
|
||||
|
||||
WeatherState GetWeatherState() const;
|
||||
uint32 m_zone;
|
||||
WeatherType m_type;
|
||||
float m_grade;
|
||||
|
||||
Reference in New Issue
Block a user