Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 09-07-2008, 09:07 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Discussion: http://eqemulator.net/forums/showthread.php?t=26083

I think I have a simple change to the scribespells and new traindiscs quest commands that should get them working as I think most people would want them to be. These changes add an argument to the commands so that a level can be defined in the command in case the admin wants to restrict the spell/disc levels that are automatically scribed.

I think this should work for both of them, but I haven't tried it yet. I will give it a try and report back with if it works or not.

questmgr.cpp
Code:
void QuestManager::scribespells(int spell_level) {
 	//Cofruben:-Scribe spells for user up to his actual level.
	int16 book_slot;
	int16 curspell;
	for(curspell = 0, book_slot = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++)
	{
	   if
	   (
		  spells[curspell].classes[WARRIOR] != 0 &&
		  spells[curspell].classes[initiator->GetPP().class_-1] <= spell_level &&
		  spells[curspell].skill != 52
	   )
	   {
		  initiator->ScribeSpell(curspell, book_slot++);
	   }
	}
}

void QuestManager::traindiscs(int disc_level) {
 	//Trevius: Train Disc for user up to their actual level.
	int16 book_slot;
	int16 curspell;
	for(curspell = 0, book_slot = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++)
	{
	   if
	   (
		  spells[curspell].classes[WARRIOR] != 0 &&
		  spells[curspell].classes[initiator->GetPP().class_-1] <= disc_level &&
		  spells[curspell].skill != 52
	   )
		{

			if(IsDiscipline(curspell)){
				for(int r = 0; r < MAX_PP_DISCIPLINES; r++) {
					if(initiator->GetPP().disciplines.values[r] == curspell) {
						initiator->Message(13, "You already know this discipline.");
						r = MAX_PP_DISCIPLINES;
					} else if(initiator->GetPP().disciplines.values[r] == 0) {
						initiator->GetPP().disciplines.values[r] = curspell;
						initiator->SendDisciplineUpdate();
						initiator->Message(0, "You have learned a new discipline!");
						r = MAX_PP_DISCIPLINES;
					}
				}
			}
	   	}
	}
}
questmgr.h
Code:
	void scribespells(int spell_level);

	void traindiscs(int disc_level);
perlparser.cpp
Code:
XS(XS__scribespells);
XS(XS__scribespells)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: scribespells(spell_level)");

	int	spell_level = (int)SvIV(ST(0));

	quest_manager.scribespells(spell_level);

	XSRETURN_EMPTY;
}

XS(XS__traindiscs);
XS(XS__traindiscs)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: traindiscs(disc_level)");

	int	disc_level = (int)SvIV(ST(0));

	quest_manager.traindiscs(disc_level);

	XSRETURN_EMPTY;
}


		newXS(strcpy(buf, "scribespells"), XS__scribespells, file);

		newXS(strcpy(buf, "traindiscs"), XS__traindiscs, file);
parser.cpp
Code:
	else if (!strcmp(command,"scribespells")) {
		quest_manager.scribespells(atoi(arglist[0]));
	}
	else if (!strcmp(command,"traindiscs")) {
		quest_manager.traindiscs(atoi(arglist[0]));
	}

These changes would require that any server using them has to change their spell scriber quests a little. This is only a minor change and should be easy for almost every server, since most only have 1 or a few spell scribers. For anyone who wants this to work as it currently does, they can simply use this in the place of the current command:

Code:
quest::scribespells($ulevel);

#OR

quest::traindiscs($ulevel);
But the nice thing about this feature is that spell scribing can be limited with it. So, maybe you want your players to be able to scribe all of their spells up to level 50 to make leveling easier, but you want them to actually collect and manually scribe all spells over level 50. You can do that easily with this. I am already coming up with some neat ideas to make using a spell sciber more interesting with this new feature. Maybe adding a spell scriber at the end of a dungeon so players have to clear to it to get their higher level spells. Or, maybe scribing higher level spells after a quest is completed. It really opens up some cool options and brings some of the fun back into getting new spells without necessarily bringing the horrid job of having to research on the web about each spell and find them or buy them all.

I will test this out and report back if it works as intended. But, as far as I can tell, this looks like good code to me.

And an optional change that I figured might as well get put in that isn't related to this new quest command is this (Changes are marked in RED):

command.cpp
Code:
void command_traindisc(Client *c, const Seperator *sep)
{
	int level;
	int16 book_slot;
	int16 curspell;
	Client *t=c;

	if(c->GetTarget() && c->GetTarget()->IsClient() && c->GetGM())
		t=c->GetTarget()->CastToClient();

	if(!sep->arg[1][0])
	{
		c->Message(0, "FORMAT: #traindisc <level>");
		return;
	}

	level = atoi(sep->arg[1]);

	if(level < 1) //used to be: if(level < 1 || level > 70)
	{
		c->Message(0, "ERROR: Enter a level greater than 1."); //used to be: "ERROR: Enter a level between 1 and 70 inclusive."
		return;
	}
This extra change is mainly so that it matches the scribespell command. I see no reason to limit the argument to level 70 as it was previously. Not a big deal either way, but it wouldn't hurt.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by cavedude; 09-24-2008 at 09:58 PM..
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 12:14 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3