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

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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-13-2016, 02:49 PM
zerjz3
Banned
 
Join Date: Aug 2010
Location: Sanctuary
Posts: 269
Default

That sounds like a really cool way of doing it, Kingly. Right now I'm using a temporary naming script but your way sounds much nicer. If you get the chance, I would love to see what you come up with
Reply With Quote
  #2  
Old 03-13-2016, 06:04 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Heading out the door, so untested to say the least:

makecustompetnamestable.sql
Code:
DROP TABLE IF EXISTS `custom_petnames`;
CREATE TABLE `custom_petnames` (
  `charid` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`charid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/quests/default.pl (insert into existing)
Code:
sub EVENT_SPAWN {
	if (!$npc || $npc->GetSwarmOwner()) {
		if ($npc->GetOwnerID()) {
			if (defined plugin::FindPetName($npc->GetOwnerID())) {
				$npc->TempName(plugin::FindPetName($npc->GetOwnerID()));
			}
		}
	}
}
/quests/global/global_player.pl (insert into existing, working off of Tabasco's original code)
Code:
sub EVENT_SAY {
    if($text =~/^!petname/i) {
        my $pid = $client->GetPetID();
        my $pet = $entity_list->GetMobByID($pid);
        if($pet) {
            ($cm, $petname) = split(/\ /, $text, 2);
            if ($petname =~ m/[^a-zA-Z]/){
				$pet->TempName($petname);
				if (plugin::FindPetName($charid) != $petname) {
					plugin::EnterPetName($charid,$petname)
				}
			$client->Message(315, "Your pet name has been changed.");
            $client->Message(315, "This is a family friendly server.  Please be considerate when choosing a pet name.");
			}
        }
    }
}
/plugins/custompetnames.pl
Code:
sub EnterPetName {
	my $dbh = plugin::MySQL_Connect();
	$dbh->do("DELETE FROM `custom_petnames` WHERE `charid` = '$_[0]'");
	$sth = $dbh->prepare("INSERT INTO `custom_petnames` (`charid`, `petname`) VALUES (?, ?)");
	$sth->execute($_[0], $_[1]);
	$sth->finish();
	$dbh->disconnect();
}

sub FindPetName {
	my $entered_charid = $_[0];
	my $dbh = plugin::MySQL_Connect();
	my $sth = $dbh->prepare("SELECT `petname` FROM `custom_petnames` WHERE `charid` = '".$entered_charid."' LIMIT 1;");
	$sth->execute();
	@data = $sth->fetchrow_array();
	$sth->finish();
	$dbh->disconnect();
	if ($data[0] == NULL) {
		return NULL;
	} else {
		return ($data[0]);
	}
}
May or may not work, untested and far from a master coder of things. But had 10 minutes before I had to leave out, it may help someone out. I'm very interested to see what Kingly draws up. *Thank you Kingly, I never bothered looking at the source to see qglobal value was const *char anymore (just sorta went by the way I knew them to be -- reading the changeme = a good thing), well then. My way is superfluous in that case.
Reply With Quote
Reply

Thread Tools
Display Modes

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 03:30 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