View Single Post
  #10  
Old 06-28-2009, 12:16 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Just a quick thought on how to implement this...

Code:
ScribeSpells(max_level, min_level = 1)
That way we default from 1 through max_level if we don't provide the second argument. So, to scribe spells for just level 71:

Code:
quest::scribespells(71, 71)
Should be pretty easy to implement in the server code. I haven't compiled or tested this, but this should do it:

Code:
Index: Y:/svn/trunk/EQEmuServer/zone/command.cpp
===================================================================
--- Y:/svn/trunk/EQEmuServer/zone/command.cpp	(revision 700)
+++ Y:/svn/trunk/EQEmuServer/zone/command.cpp	(working copy)
@@ -5694,7 +5695,7 @@
 
 void command_scribespells(Client *c, const Seperator *sep)
 {
-	int level;
+	uint8 max_level, min_level;
 	int16 book_slot;
 	int16 curspell;
 	Client *t=c;
@@ -5704,29 +5705,36 @@
 
 	if(!sep->arg[1][0])
 	{
-		c->Message(0, "FORMAT: #scribespells <level>");
+		c->Message(0, "FORMAT: #scribespells <max level> <min level>");
 		return;
 	}
 
-	level = atoi(sep->arg[1]);
+	max_level = (uint8)atoi(sep->arg[1]);
+	min_level = sep->arg[2][0] ? (uint8)atoi(sep->arg[2]) : 1;
 
-	if(level < 1)
+	if(max_level < 1)
 	{
 		c->Message(0, "ERROR: Enter a level greater than 1.");
 		return;
 	}
 
+	if (max_level < min_level) {
+		c->Message(0, "ERROR: Min Level can't be greater than Max Level.");
+		return;
+	}
+
 	t->Message(0, "Scribing spells to spellbook.");
 	if(t != c)
 		c->Message(0, "Scribing spells for %s.", t->GetName());
-	LogFile->write(EQEMuLog::Normal, "Scribe spells request for %s from %s, level: %d", t->GetName(), c->GetName(), level);
+	LogFile->write(EQEMuLog::Normal, "Scribe spells request for %s from %s (min level: %u, max_level: %u)", t->GetName(), c->GetName(), min_level, max_level);
 
 	for(curspell = 0, book_slot = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++)
 	{
 		if
 		(
 			spells[curspell].classes[WARRIOR] != 0 && // check if spell exists
-			spells[curspell].classes[t->GetPP().class_-1] <= level && 
+			spells[curspell].classes[t->GetPP().class_-1] <= max_level &&	//maximum level
+			spells[curspell].classes[t->GetPP().class_-1] >= min_level &&	//minimum level
 			spells[curspell].skill != 52
 		)
 		{

Index: Y:/svn/trunk/EQEmuServer/zone/perlparser.cpp
===================================================================
--- Y:/svn/trunk/EQEmuServer/zone/perlparser.cpp	(revision 700)
+++ Y:/svn/trunk/EQEmuServer/zone/perlparser.cpp	(working copy)
@@ -789,12 +789,16 @@
 XS(XS__scribespells)
 {
 	dXSARGS;
-	if (items != 1)
+	if (items < 1)
 		Perl_croak(aTHX_ "Usage: scribespells(spell_level)");
 
-	int	spell_level = (int)SvIV(ST(0));
+	uint8 max_level = (uint8)SvIV(ST(0));
+	uint8 min_level = (uint8)SvIV(ST(1));
 
-	quest_manager.scribespells(spell_level);
+	if (min_level)
+		quest_manager.scribespells(max_level, min_level);
+	else
+		quest_manager.scribespells(max_level);
 
 	XSRETURN_EMPTY;
 }

Index: Y:/svn/trunk/EQEmuServer/zone/questmgr.cpp
===================================================================
--- Y:/svn/trunk/EQEmuServer/zone/questmgr.cpp	(revision 701)
+++ Y:/svn/trunk/EQEmuServer/zone/questmgr.cpp	(working copy)
@@ -624,7 +624,7 @@
 	initiator->Kick();
 }
 
-void QuestManager::scribespells(int spell_level) {
+void QuestManager::scribespells(uint8 max_level, uint8 min_level = 1) {
  	//Cofruben:-Scribe spells for user up to his actual level.
 	int16 book_slot;
 	int16 curspell;
@@ -633,7 +633,8 @@
 	   if
 	   (
 		  spells[curspell].classes[WARRIOR] != 0 &&
-		  spells[curspell].classes[initiator->GetPP().class_-1] <= spell_level &&
+		  spells[curspell].classes[initiator->GetPP().class_-1] <= max_level &&	//maximum level
+		  spells[curspell].classes[initiator->GetPP().class_-1] <= min_level &&	//minimum level
 		  spells[curspell].skill != 52
 	   )
 	   {
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote