Hey there.
As we know there are currently some problems with the instance/id system, since the creatures DO even respawn if the players have an ID with that instance.
I have tried something to stop that respawning of creatures in instances with an ID and since this is the section for discussing code, I would like to know what you think of my try to fix it.
First of all, some revisions I am currently using:
MaNGOS: 7739
ScriptDev2: 1035
UDB: 371
ACID: 28
How I tested the respawning of creatures in instances with an ID:
I used 2 accounts to test it. I just created a raid group with two characters and entered the instance (in my example Zul'Aman). GM mode was OFF and my characters were visible. Then I spawned an instance boss (so I do not need to walk the whole way ). I killed the boss using the ".die" command and my characters were bound to the instance.
After that I left the group with one of my characters and the group was disbanded. Then I shut down the server and restarted it. The boss was respawned again.
How I got the (following) idea to fix it:
I put some debug lines near all places where the SQL command "DELETE FROM creature_respawn" is used. So I noticed, that the function "ObjectMgr:: DeleteRespawnTimeForInstance(instanceId)" is that function that removed the remaining respawntime of my creature.
After that I searched all places, where that function is called and I used debug lines again, to get the right function call. The function "InstanceMap::UnloadAll(bool pForce)" called the function for the deleting of the respawntime.
And this is the place where my fix is located...
The fix:
First of all here a link to the patch:
New version (SQL):
http://paste2.org/p/199545
BUGGED OLD VERSION 2:
http://paste2.org/p/199313
BUGGED OLD VERSION:
http://paste2.org/p/197700
As you can see, there is a variable called "m_resetAfterUnload" that needs to be true in order to be able to call the deleting function. I added a new variable here "bool instanceHasId". This variable needs to be false, so the deleting function can be called.
This variable is first set to false. But it can be set to true, if a player on the instance map has an ID for the instance map he is in.
=> So the instance's respawntimes will NOT be deleted, if a player on the instance map is bound to the instance. <=
I think this could be a correct solution and I would like to know, what you think about this try to fix it.
Happy about any responses.