Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 09-21-2008, 11:10 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default New Quest Command quest::clearspawntimers()

Discussion: http://eqemulator.net/forums/showthread.php?t=26295

This command should work similar to the "#repop force" command which will reset the spawn timers for the zone and repop everything including anything that was down due to having a timer left on it. I haven't tested this code yet, but I am going to test it tonight and verify it works. I basically just looked at the code for quest::repopzone() and for the command #repop and combined the 2, so I think it should work. I will report back later after I get the chance to test it.


questmgr.cpp
Code:
void QuestManager::clearspawntimers() {
	if(zone)  {
		char errbuf[MYSQL_ERRMSG_SIZE];
		char *query = 0;
		database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET timeleft=0 WHERE zone='%s'",zone->GetShortName()), errbuf);
		safe_delete_array(query);
	}
}
questmgr.h
Code:
	void clearspawntimers();

perlparser.cpp
Code:
XS(XS__clearspawntimers);
XS(XS__clearspawntimers)
{
	dXSARGS;
	if (items != 0)
		Perl_croak(aTHX_ "Usage: clearspawntimers()");

	quest_manager.clearspawntimers();

	XSRETURN_EMPTY;
}
Code:
		newXS(strcpy(buf, "clearspawntimers"), XS__clearspawntimers, file);
If this doesn't work, I will keep messing with it until I can get it working unless someone else feels like making some suggestions.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 09-21-2008, 11:45 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Compiled so far without a problem. Now to test if after the reboot tonight on my server :P
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 09-21-2008, 11:49 PM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

Why post before testing?
Reply With Quote
  #4  
Old 09-21-2008, 11:56 PM
renoofturks1
Sarnak
 
Join Date: Jan 2008
Posts: 60
Default

So others may see it and review his work. I prefer to have someone one over my cod before it goes live onto a server. Other people may be able to see things you never even thought of.
Reply With Quote
  #5  
Old 09-22-2008, 12:11 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Quote:
Originally Posted by MNWatchdog View Post
Why post before testing?
Ya, mostly posting because I can write this while I am work, but I can't test it from work. I might as well note the code here even if it isn't fully tested yet IMO. This should be pretty simple code and even if it doesn't work, I am sure it will work after 1 or 2 small changes. This way people get a chance to review it and point out if there are any major mistakes before I test it out on my server potentially effecting 50 - 80 players while I try the code.

Normally I would just post new code ideas in the development section if I am not too sure that they will work. But in this case, just setting up a quest command by using code from a normal command should be pretty straight forward. I got the new traindiscs and new version of scribespells quest commands working that way easy enough. Plus, being a mod, I can always go back and edit my post at any time to make any corrections to the code if needed or even move the post to another section if it never gets finished :P

I don't have a clue of how to write code from scratch, but I work pretty well from example
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #6  
Old 09-22-2008, 03:05 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Ok, I changed how this command works slightly after testing the code. I renamed the command to quest::clearspawntimers(), and now it is just used to clear the spawn timers. So, you have the option to do a quest::repopzone() after it, or just let it wait until the zone goes down and comes back up, or whatever.

The code I submitted above has been tested and is working fine on my server. If people think it would be better just to add in the actual repop to the command, I could do that instead, but I always like having open options
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #7  
Old 09-22-2008, 01:45 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

This is a great command! There are plenty of times on PEQ when I'm fiddling with spawns, and when I am done and am about to go to do a /repop force I see people hunting in the zone. In order to not disturb them, I just set timeleft to 0 in the DB at a prompt and leave. This guy just made my life easier!
Reply With Quote
  #8  
Old 09-23-2008, 06:40 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Well, this is a quest command, but I could certainly make a normal # command for it as well if you like. They are pretty simple with examples hehe.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #9  
Old 09-23-2008, 09:48 AM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

It's no real difference to me. I have a custom NPC in PEQ's template folder that I spawn whenever I need to test something or the like.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 01:44 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3