Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::General Support

Support::General Support Post all topics here having to do with errors while trying to connect to an EQEMu server but not about the setup/running of the Server itself.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 11-24-2016, 12:07 AM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

This assumes you have DBI Perl installed (instructions are in the Wiki). And, it's by far untested (even for syntax, sorry away from my home PC for the holidays):

Code:
## global_player.pl

sub EVENT_TIMER {
	if ($timer eq "RecordCharacter") {
		RecordCharacterMemmedSpells($charid);
	}
}

sub EVENT_SAY {
	if ($text=~/#loadspells/i) {
		if (defined $qglobals{"memmedspells"}) {
			LoadMemmedSpells();
		} else {
			$client->Message(15, "You have no spell slots in custom memory!");
		}
	}
}

sub EVENT_CONNECT {
	LoadMemmedSpells() if (defined $qglobals{"memmedspells"});
	quest::settimer("RecordCharacter", 10);
}

sub LoadMemmedSpells {
	$client->UnmemSpellAll(1); ## just a sanity thing
	foreach my $i (0..9) { ## forget current maximum spell slots
		if (defined $qglobals{"memmedspellslot$i"}) {
			$client->MemSpell($qglobals{"memmedspellslot$i"}, $i, 1);
		}
	}
}
	
sub RecordCharacterMemmedSpells {
	my $dbh = plugin::MySQL_Connect();
	my $sth = $dbh->prepare("
								SELECT slot_id, spell_id
								FROM character_memmed_spells
								WHERE id = ?
							");
	$sth->bind_param(1,$_[0]);
	$sth->execute();
	if ($sth->rows() > 0) {
		quest::setglobal("memmedspells", 1, 5, "F");
		while (my @row = $sth->fetchrow_array()) {
			quest::setglobal("memmedspellslot$row[0]", $row[1], 5, "F");
		}
	}
	$sth->finish();
	$dbh->disconnect();
}
(shrug) hopefully someone comes in and gives it a look over, second+ set of eyes never hurt.

*Edit: The code above is sort of moot now after having been enlightened by Kingly's post. But will leave it for those that like Perl.

Last edited by ghanja; 11-24-2016 at 12:27 AM.. Reason: Moot now
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 01:32 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