Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-03-2008, 07:05 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default quest::traindiscs()

***EDIT: Look at my post about 9 down from this one for the actual code to add in that is tested and working and includes changes to scribespells() as well as the new working traindiscs() quest command ***

This is a new quest command similar to the quest::scribespells command. The idea is the same, accept instead of scribing all spells up to the user's level, this will scribe all Disciplines up to their level. I have not tested this code yet, which is why I am posting it in the development section. But once I get it tested and confirm that it works, I will move this post to the Server Code Submissions section.

Here is the new code:

questmgr.cpp
Code:
void QuestManager::traindiscs() {
 	//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] <= initiator->GetLevel() &&
		  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 traindiscs();

perlparser.cpp
Code:
XS(XS__traindiscs);
XS(XS__traindiscs)
{
	dXSARGS;
	if (items != 0)
		Perl_croak(aTHX_ "Usage: traindiscs()");


	quest_manager.traindiscs();

	XSRETURN_EMPTY;
}
Code:
		newXS(strcpy(buf, "traindiscs"), XS__traindiscs, file);

If anyone has any corrections or suggestions, please let me know here



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 trevius; 09-22-2008 at 04:02 AM..
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 12:31 AM.


 

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