mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Respawns] Convert Respawn Times to Repositories (#3949)
* [Respawns] Convert Respawn Times to Repositories - Convert `respawn_times` based methods to repositories. * Missed some. * Comments
This commit is contained in:
+18
-14
@@ -3090,35 +3090,39 @@ void QuestManager::removeitem(uint32 item_id, uint32 quantity) {
|
||||
initiator->RemoveItem(item_id, quantity);
|
||||
}
|
||||
|
||||
void QuestManager::UpdateSpawnTimer(uint32 id, uint32 newTime)
|
||||
void QuestManager::UpdateSpawnTimer(uint32 spawn2_id, uint32 new_time)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
database.UpdateRespawnTime(id, 0, (newTime/1000));
|
||||
database.UpdateRespawnTime(spawn2_id, 0, (new_time / 1000));
|
||||
|
||||
LinkedListIterator<Spawn2*> iterator(zone->spawn2_list);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements())
|
||||
{
|
||||
if(iterator.GetData()->GetID() == id)
|
||||
{
|
||||
if(!iterator.GetData()->NPCPointerValid())
|
||||
{
|
||||
iterator.GetData()->SetTimer(newTime);
|
||||
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()->GetID() == spawn2_id) {
|
||||
if (!iterator.GetData()->NPCPointerValid()) {
|
||||
iterator.GetData()->SetTimer(new_time);
|
||||
}
|
||||
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
iterator.Advance();
|
||||
}
|
||||
|
||||
if(!found)
|
||||
{
|
||||
if (!found) {
|
||||
//Spawn wasn't in this zone...
|
||||
//Tell the other zones to update their spawn time for this spawn point
|
||||
auto pack = new ServerPacket(ServerOP_UpdateSpawn, sizeof(UpdateSpawnTimer_Struct));
|
||||
UpdateSpawnTimer_Struct *ust = (UpdateSpawnTimer_Struct*) pack->pBuffer;
|
||||
ust->id = id;
|
||||
ust->duration = newTime;
|
||||
|
||||
auto ust = (UpdateSpawnTimer_Struct*) pack->pBuffer;
|
||||
|
||||
ust->id = spawn2_id;
|
||||
ust->duration = new_time;
|
||||
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user