mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 11:28:25 +00:00
[Spawn] (imported from takp) Added min_time and max_time to spawnentry. This will prevent a NPC from… (#3685)
* 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>
This commit is contained in:
+27
-9
@@ -29,12 +29,13 @@
|
||||
extern EntityList entity_list;
|
||||
extern Zone *zone;
|
||||
|
||||
SpawnEntry::SpawnEntry(uint32 in_NPCType, int in_chance, uint16 in_filter, uint8 in_npc_spawn_limit)
|
||||
{
|
||||
SpawnEntry::SpawnEntry(uint32 in_NPCType, int in_chance, uint16 in_filter, uint8 in_npc_spawn_limit, uint8 in_min_time, uint8 in_max_time) {
|
||||
NPCType = in_NPCType;
|
||||
chance = in_chance;
|
||||
condition_value_filter = in_filter;
|
||||
npc_spawn_limit = in_npc_spawn_limit;
|
||||
min_time = in_min_time;
|
||||
max_time = in_max_time;
|
||||
}
|
||||
|
||||
SpawnGroup::SpawnGroup(
|
||||
@@ -85,8 +86,15 @@ uint32 SpawnGroup::GetNPCType(uint16 in_filter)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (se->condition_value_filter != in_filter)
|
||||
if (se->min_time != 0 && se->max_time != 0 && se->min_time <= 24 && se->max_time <= 24) {
|
||||
if (!zone->zone_time.IsInbetweenTime(se->min_time, se->max_time)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (se->condition_value_filter != in_filter) {
|
||||
continue;
|
||||
}
|
||||
|
||||
totalchance += se->chance;
|
||||
possible.push_back(se);
|
||||
@@ -224,7 +232,9 @@ bool ZoneDatabase::LoadSpawnGroups(const char *zone_name, uint16 version, SpawnG
|
||||
chance,
|
||||
condition_value_filter,
|
||||
npc_types.spawn_limit
|
||||
AS sl
|
||||
AS sl,
|
||||
min_time,
|
||||
max_time
|
||||
FROM
|
||||
spawnentry,
|
||||
spawn2,
|
||||
@@ -251,7 +261,9 @@ bool ZoneDatabase::LoadSpawnGroups(const char *zone_name, uint16 version, SpawnG
|
||||
Strings::ToInt(row[1]),
|
||||
Strings::ToInt(row[2]),
|
||||
Strings::ToInt(row[3]),
|
||||
(row[4] ? Strings::ToInt(row[4]) : 0)
|
||||
(row[4] ? Strings::ToInt(row[4]) : 0),
|
||||
Strings::ToInt(row[5]),
|
||||
Strings::ToInt(row[6])
|
||||
);
|
||||
|
||||
SpawnGroup *spawn_group = spawn_group_list->GetSpawnGroup(Strings::ToInt(row[0]));
|
||||
@@ -340,7 +352,9 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawn_group_id, SpawnGroupList *spawn
|
||||
spawnentry.npcid,
|
||||
spawnentry.chance,
|
||||
spawnentry.condition_value_filter,
|
||||
spawngroup.spawn_limit
|
||||
spawngroup.spawn_limit,
|
||||
spawnentry.min_time,
|
||||
spawnentry.max_time
|
||||
FROM
|
||||
spawnentry,
|
||||
spawngroup
|
||||
@@ -361,16 +375,20 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawn_group_id, SpawnGroupList *spawn
|
||||
Strings::ToInt(row[1]),
|
||||
Strings::ToInt(row[2]),
|
||||
Strings::ToInt(row[3]),
|
||||
(row[4] ? Strings::ToInt(row[4]) : 0)
|
||||
(row[4] ? Strings::ToInt(row[4]) : 0),
|
||||
Strings::ToInt(row[5]),
|
||||
Strings::ToInt(row[6])
|
||||
);
|
||||
|
||||
LogSpawnsDetail(
|
||||
"Loading spawn_entry spawn_group_id [{}] npc_id [{}] chance [{}] condition_value_filter [{}] spawn_limit [{}]",
|
||||
"Loading spawn_entry spawn_group_id [{}] npc_id [{}] chance [{}] condition_value_filter [{}] spawn_limit [{}] min_time [{}] max_time [{}] ",
|
||||
row[0],
|
||||
row[1],
|
||||
row[2],
|
||||
row[3],
|
||||
row[4]
|
||||
row[4],
|
||||
row[5],
|
||||
row[6]
|
||||
);
|
||||
|
||||
SpawnGroup *spawn_group = spawn_group_list->GetSpawnGroup(Strings::ToInt(row[0]));
|
||||
|
||||
Reference in New Issue
Block a user