View Single Post
  #87  
Old 12-23-2013, 12:56 PM
Splorf22 Splorf22 is offline
Planar Protector


Join Date: Mar 2011
Posts: 3,236
Default

Quote:
Originally Posted by Aeolwind [You must be logged in to view images. Log in or Register.]
Find a problem you want to fix, download source, review, write a fix, PM to a blue or red name.
In questmgr.cpp there exists:
Code:
void QuestManager::UpdateSpawnTimer(uint32 id, uint32 newTime)
{
	bool found = false;

	database.UpdateSpawn2Timeleft(id, 0, (newTime/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);
			}
			found = true;
			break;
		}
		iterator.Advance();
	}

	if(!found)
	{
		//Spawn wasn't in this zone...
		//Tell the other zones to update their spawn time for this spawn point
		ServerPacket *pack = new ServerPacket(ServerOP_UpdateSpawn, sizeof(UpdateSpawnTimer_Struct));
		UpdateSpawnTimer_Struct *ust = (UpdateSpawnTimer_Struct*)pack->pBuffer;
		ust->id = id;
		ust->duration = newTime;
		worldserver.SendPacket(pack);
		safe_delete(pack);
	}
}
This appears to do exactly what you want: it updates the database and communicates with the other zone servers if necessary. Is the QuestManager stuff not available from your perl scripts? Or is it difficult to get the NPC id? I poked around in the source a bit more and it *looks* like a static global id per mob, but maybe not.

Anyway, basically I agree with Jeremy: it simply cannot be that hard to implement this, and it would be huge for the community.
__________________
Raev | Loraen | Sakuragi <The A-Team> | Solo Artist Challenge | Farmer's Market
Quote:
Originally Posted by Arteker
in words of anal fingers, just a filthy spaniard