Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #15  
Old 03-21-2010, 05:10 PM
MNWatchdog
Hill Giant
 
Join Date: Feb 2006
Posts: 179
Default

It's hardly for lazy people.

For examples, NPC ID 214001 belongs to 6 different spawn2 groups. Certainly a lot easier for someone to find 1 NPC ID over finding the 6 spawn groups it belongs to.

Multiply this by the 50ish NPC IDs who I'm prevent from spawning, it's a lot of looking up.

PS. How does this look?
Code:
# This is a work in progress.  Do NOT use.

sub GetSpawn2GroupIDs
{
use DBI;

my $npcID = shift;
printf("Parms 1 = %d\n", $npcID);

my $confile = "eqemu_config.xml"; #default
my $zonen = "potactics"; #only for testing
my $db = "eq";
my $user = "eq";
my $pass = "eq";
my $host = "localhost";

open(F, "<$confile") or die "Unable to open config: $confile\n";
my $indb = 0;

while(<F>) {
	s/\r//g;
	if(/<database>/i) {
		$indb = 1;
	}
	next unless($indb == 1);
	if(/<\/database>/i) {
		$indb = 0;
		last;
	}
	if(/<host>(.*)<\/host>/i) {
		$host = $1;
	} elsif(/<username>(.*)<\/username>/i) {
		$user = $1;
	} elsif(/<password>(.*)<\/password>/i) {
		$pass = $1;
	} elsif(/<db>(.*)<\/db>/i) {
		$db = $1;
	}
}
if(!$db || !$user || !$pass || !$host) {
	die "Invalid database info, missing one of: host, user, password, database\n";
}

my $source = "DBI:mysql:database=$db;host=$host";
my $dbh = DBI->connect($source, $user, $pass) || die "Could not create db handle\n";

my $spawngroupIDs = $dbh->prepare("SELECT * FROM  spawnentry WHERE npcID=$npcID");

$spawngroupIDs->execute(); #run the query on the db to get list of spawngroupIDs using NPC ID that Spawn2 uses

my($val2, $spawn2id, @spawn2groupsIDs); #define some variables, cause we're cool like that

while (my $val = $spawngroupIDs->fetch()) {
	$spawn2id = $dbh->prepare("SELECT * FROM spawn2 WHERE spawngroupID=@$val[0] AND zone='$zonen'");
	$spawn2id->execute();
	$val2 = $spawn2id->fetch();
	if(@$val2[0]) {
		push(@spawn2groupsIDs, @$val2[0]);
		}
}
return @spawn2groupsIDs;
}
Literally working on this right now. Got it finding all the spawn 2 IDs for a NPCs ID, now going to work on having it accept X, Y and Z perimeters.

PS I wasn't able to find any script that use Disable_Spawn2 and I'm guessing part of the reason is because it is to much of a hassle to write whole lists of spawn2 points.
Reply With Quote
 


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 06:22 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