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

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-11-2004, 09:37 AM
RangerDown
Demi-God
 
Join Date: Mar 2004
Posts: 1,066
Default #spawnfix -- fixed!

The #spawnfix command in its current implementation has some shortcomings. Main one being that it tries to search the spawn2 database based on the mob's current x,y,z,heading - which means that
(1) if the mob starts moving or turns to face another direction, you can't use #spawnfix after that
(2) because of imprecision in the way floats are saved to the database, you effectively get to use #spawnfix ONCE per mob, and after that it will give you the "duplicate spawns detected" if you ever try to fix that same mob spawn again.

This rewritten #spawnfix command gets rid of those limitations by using the mob's spawn ID number from the database, instead of trying to query based on the mob's current position.

In zone/command.cpp, seek to where the "command_spawnfix" function is defined. Remove it completely, and replace it with this function:

Code:
void command_spawnfix(Client *c, const Seperator *sep)
{
	Mob *t = c->GetTarget();
	if (!t || !t->IsNPC())
		c->Message(0, "Error: #spawnfix: Need an NPC target.");
	else {
		Spawn2* s2 = t->CastToNPC()->respawn2;
		char errbuf[MYSQL_ERRMSG_SIZE];
		char *query = 0;

		if(!s2)
		{   c->Message(0, "#spawnfix FAILED -- cannot determine which spawn entry in the database this mob came from.");
		}
		else
		{   if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET x='%f', y='%f', z='%f', heading='%f' WHERE id='%i'",c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(),s2->GetID()), errbuf))
		    {	c->Message(0, "Updating coordinates successful.");
			t->Depop(false);
		    }
		    else
		    {	c->Message(13, "Update failed! MySQL gave the following error:");
			c->Message(13, errbuf);
		    }
		    safe_delete_array(query);
		}
	}
}
__________________
<idleRPG> Rogean ate a plate of discounted, day-old sushi. This terrible calamity has slowed them 0 days, 15:13:51 from level 48.
Reply With Quote
  #2  
Old 09-11-2004, 01:45 PM
eq_addict_08
Hill Giant
 
Join Date: Nov 2003
Location: Drunk tank
Posts: 199
Default

sweet, I hated getting that "duplicate spawns" error...
Reply With Quote
  #3  
Old 09-17-2004, 10:42 AM
relorm500
Hill Giant
 
Join Date: Apr 2004
Location: Bafoon.........
Posts: 193
Default

OMG you rule all, F what Melwin owns.





Just Kidding Melwin.
Melwin = King of all
__________________
----->I AM THE BAFOON 1337<-----
Bafoon.............
will he return??
Ba Fo On
Reply With Quote
  #4  
Old 09-17-2004, 11:31 AM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

Quote:
Originally Posted by relorm500
OMG you rule all, F what Melwin owns.





Just Kidding Melwin.
Melwin = King of all
/sigh
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
Reply With Quote
  #5  
Old 09-17-2004, 11:33 AM
Cripp's Avatar
Cripp
Discordant
 
Join Date: Oct 2003
Location: The Shire
Posts: 474
Default

lol why are you so obsessed with melwin
__________________
Nug Blazers - ServerOP / founder
^^comming... later!

www.nugblazers.com
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 07:01 AM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3