mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
* Added mintime and maxtime to spawnentry. This will prevent a NPC from spawning outside of the times specified. NPCs spawned in this way will then behave like normal NPCs. They will not despawn on their own, unlike spawn_events/spawn_conditions. NPCs using this that are alone in their spawngroup will attempt to spawn after their respawn timer has expired if the time of day is outside their range. Otherwise, another NPC in the spawngroup will be chosen to spawn. The normal rules (chance, spawn_limit) still apply to these NPCs, this is just another rule added to the system. mintime and maxtime both represent the in-game EQ Hour. Valid values are 1-24. If either or both of the values are 0, then the NPC will not have any time restriction. Added a new rule World:BootHour. This allows server admins to specify the EQ hour the server will boot to. Valid options are 1-24. Setting this rule to 0 (default) disables it and world will use whatever time is specified in the DB. * generated base_spawnentry_repository.h from script * removed the rule insert from database_update_manifest.cpp. * Add logging, initializers, minor cleanup * Remove if/else branch * Update eqtime.cpp * Initializers, logging --------- Co-authored-by: Akkadius <akkadius1@gmail.com>
53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
#ifndef EQTIME_H
|
|
#define EQTIME_H
|
|
|
|
#include "../common/eq_packet_structs.h"
|
|
#include <string>
|
|
|
|
//Struct
|
|
struct eqTimeOfDay
|
|
{
|
|
TimeOfDay_Struct start_eqtime;
|
|
time_t start_realtime;
|
|
};
|
|
|
|
//Class Def
|
|
class EQTime
|
|
{
|
|
public:
|
|
//Constructor/destructor
|
|
EQTime(TimeOfDay_Struct start_eq, time_t start_real);
|
|
EQTime();
|
|
~EQTime() = default;
|
|
|
|
//Get functions
|
|
int GetCurrentEQTimeOfDay( TimeOfDay_Struct *eqTimeOfDay ) { return(GetCurrentEQTimeOfDay(time(nullptr), eqTimeOfDay)); }
|
|
int GetCurrentEQTimeOfDay( time_t timeConvert, TimeOfDay_Struct *eqTimeOfDay );
|
|
TimeOfDay_Struct getStartEQTime() { return eqTime.start_eqtime; }
|
|
time_t getStartRealTime() { return eqTime.start_realtime; }
|
|
uint32 getEQTimeZone() { return timezone; }
|
|
uint32 getEQTimeZoneHr() { return timezone/60; }
|
|
uint32 getEQTimeZoneMin() { return timezone%60; }
|
|
bool IsDayTime();
|
|
bool IsNightTime();
|
|
bool IsInbetweenTime(uint8 min_time, uint8 max_time);
|
|
|
|
//Set functions
|
|
int SetCurrentEQTimeOfDay(TimeOfDay_Struct start_eq, time_t start_real);
|
|
void setEQTimeZone(int32 in_timezone) { timezone=in_timezone; }
|
|
|
|
//Time math/logic functions
|
|
static bool IsTimeBefore(TimeOfDay_Struct *base, TimeOfDay_Struct *test); //is test before base
|
|
static void AddMinutes(uint32 minutes, TimeOfDay_Struct *to);
|
|
|
|
static void ToString(TimeOfDay_Struct *t, std::string &str);
|
|
|
|
private:
|
|
//This is our reference clock.
|
|
eqTimeOfDay eqTime;
|
|
//This is our tz offset
|
|
int32 timezone;
|
|
};
|
|
|
|
#endif
|