View Full Version : quest::traindiscs()
trevius
09-03-2008, 07:05 PM
***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
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
void traindiscs();
perlparser.cpp
XS(XS__traindiscs);
XS(XS__traindiscs)
{
dXSARGS;
if (items != 0)
Perl_croak(aTHX_ "Usage: traindiscs()");
quest_manager.traindiscs();
XSRETURN_EMPTY;
}
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
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.
AndMetal
09-04-2008, 12:12 AM
Just a thought so far, but wouldn't it be better to allow an argument, say level, so that you could have some flexibility instead of just using the current level? For example, a mob that will only train you up to level 10 (for noobs), and you have to get the rest of your spells normally.
trevius
09-04-2008, 03:04 AM
Well, I was going by the example of scribespells. Currently I just allow the use of #traindisc command on my server, but I would love to remove the need for that. Though, I do think it would be nice if there was an option to train up to a certain level. But, I think it should be set so that if you don't set anything it will go by current level as the max.
So_1337
09-04-2008, 08:49 AM
As AndMetal pointed out, I think that that's one of the failings of quest::scribespell, and it'd be nice to not repeat the same mistake here =P
I know I'd intended for every class to be able to have their spells scribed up to level 51 on my server, but I had to change it for mages; I didn't want them getting a free epic. Having more flexibility with the scribespell function (and the proposed traindisc) can only help.
Secrets
09-04-2008, 11:29 AM
I know I'd intended for every class to be able to have their spells scribed up to level 51 on my server, but I had to change it for mages; I didn't want them getting a free epic. Having more flexibility with the scribespell function (and the proposed traindisc) can only help.
Just a quick FYI, if you don't want people getting spells on scribespells, change the spell file SERVERSIDED ONLY to class level 255 on that spell that you don't want. This will disable the spell.
Provided you do not have spell scrolls, of course, then it's another issue altogether.
So_1337
09-04-2008, 11:35 AM
I want them to have the spell available to them, just not via a spell-scribing NPC. If they complete the magician epic, they sure deserve to use it =P
That's a good tip for some other spells that might be included in what are scribed, though, such as if I wanted to limit spells from the scriber by different eras. Then update the file once a new era is unlocked. (We're currently doing progression.)
Thanks for the tip, didn't consider that =)
trevius
09-05-2008, 12:20 AM
Good point. I supposed that if scribespells worked the ideal way, you could just do quest::scribespells($ulevel); to achieve the same effect that it currently does, but you would still have the option to set any other level you wanted it to be.
And, if you don't want a class to have a certain spell, it is probably best to scribe them all and then unscribe the 1 spell with quest::unscribespell();. Though, you might need to use a timer to delay and make sure the scribing finishes before the unscribe happens.
So_1337
09-05-2008, 08:49 AM
Another interesting idea. Thank you so much. Sorry for having derailed the thread a bit, but I don't think you're in any danger. Your idea's quite a nice proposal, I think it's a no-brainer, even =P
trevius
09-06-2008, 06:30 AM
I moved this post to Server Code Submissions. I tested out the code in my first post and had to change "t" to "initiator" (which I already edited into the post), and it works perfectly as intended. I think this is ready for the official source.
This is for the discipline version of the quest::scribespells() command. It works almost exactly the same way.
If someone wanted to make new versions for both scribespells and traindiscs that has an argument option, then please do. The idea for an argument that allows you to define how high to scribe/train to in level has already been mentioned, but that is a little above my coding level still lol. I don't actually code anything, I just steal code from elsewhere and use it from example.
trevius
09-07-2008, 09:07 PM
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
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
void scribespells(int spell_level);
void traindiscs(int disc_level);
perlparser.cpp
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
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:
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
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.
ChaosSlayer
09-07-2008, 10:54 PM
quick question
do you have to turn in your discipline book to GM to get ability?
cuase on live since 2006 they made it so you can now scribe your melee discpline tome just like a caster scroll - no gm turn in needed.
would be nice if we could do it the same way. less messing with gms
trevius
09-08-2008, 04:39 AM
I don't see any reason why you wouldn't be able to make tomes scribe-able. You would just need to make it like a normal spell scroll accept use the disc spell ID instead of a spell. The only reason that the scribespells command doesn't train disciplines is because there is code to block disciplines from being scribed when you use it. But there is nothing as far as I know to keep spell scrolls from doing it.
So far the last code I submitted above for the new scribespells and traindiscs commands with arguments compiled. Now to see if they actually work after a server reboot :)
trevius
09-08-2008, 08:00 AM
Woot! Just confirmed that my last code post here for the new scribespells and traindiscs works perfectly as intended. I tried setting them both to level 10 and it only trained up to level 10. Then I tried using $ulevel and they both worked the way they used to by scribing/training up to my level!
Not a huge or complex code change, but I think it is something that has been needed for a while. And I think I am finally starting to learn a little by using examples in the source :)
If this makes it into the official code, then it would probably be a good idea to note that scribespells() won't work anymore unless it has the level argument. But a simple change to scribespells($ulevel) works perfectly as a replacement. So, any server using this command will need to make the appropriate changes for it to work again after the update.
Of course, the command name could be changed to add in 1 more command, but IMO this is the way that scribespells should work in the first place. And it really only requires a very minor script change for any server. I don't think it is more than asking them to add required SQL.
ChaosSlayer
09-08-2008, 09:13 AM
I don't see any reason why you wouldn't be able to make tomes scribe-able. You would just need to make it like a normal spell scroll accept use the disc spell ID instead of a spell. The only reason that the scribespells command doesn't train disciplines is because there is code to block disciplines from being scribed when you use it. But there is nothing as far as I know to keep spell scrolls from doing it.
So far the last code I submitted above for the new scribespells and traindiscs commands with arguments compiled. Now to see if they actually work after a server reboot :)
I think you missunderstood me.
I don't meant scribeable like using scribe quest comand
I mean using old fashion- open spell book and scribing (puting) spell scroll into it.
On LIVE they made it that melees simply right click the Discipline Tome- like reading a book - and they now know the discipline.
kind of like spell scribing (memorizing) works in eq2
it just pure melees do not have spell book nor spell bar otherwise I would have made all disciplines to be spells (just payable with endurance)
AndMetal
09-08-2008, 05:25 PM
I don't see any reason why you wouldn't be able to make tomes scribe-able. You would just need to make it like a normal spell scroll accept use the disc spell ID instead of a spell. The only reason that the scribespells command doesn't train disciplines is because there is code to block disciplines from being scribed when you use it. But there is nothing as far as I know to keep spell scrolls from doing it.
So far the last code I submitted above for the new scribespells and traindiscs commands with arguments compiled. Now to see if they actually work after a server reboot :)
I think you missunderstood me.
I don't meant scribeable like using scribe quest comand
I mean using old fashion- open spell book and scribing (puting) spell scroll into it.
You both are actually talking about the same thing. Trev was only saying the reason the #scribespells command doesn't train disciplines because the code for that command basically filters those out. Basically, if spell->IsDiscipline, keep it moving.
However, I think there may be a problem. Comparing a Discipline Tome (http://lucy.allakhazam.com/itemraw.html?id=66297) & Spell Scroll (http://lucy.allakhazam.com/itemraw.html?id=78507), they have the same scrolltype (7, which I believe is for all spell scrolls) & have a corresponding spell ID. I think there might have been a change in the client to allow it to be done, since spells have to still be clicked into the spell book to scribe them (can't right-click them).
I'm sure it could be done by piggybacking the spell casting system, but it would be more of a hack than anything. In addition, it would require changing all of the tomes in the database to be right-click castable (like a regular, instant cast clickie).
Now, if we ever make it to the Anniversary client, I'm sure it's a possibility, but that's still a ways off. *Looks at Derision with his OpCode hunting & packet structure deriving skeelz*
trevius
09-09-2008, 05:15 AM
Using the means that Derison uses to find Opcodes in Titanium that are known in the 6.2 client, I don't think getting a newer version of EQ working for the emulator would be all too bad. At least not if we broke the work up into separate parts and had multiple people all working on different parts at the same time. I imagine a decent wiki page for doing what he does and a little practice, we could have at least a few regulars on the forums to help get it done in a fair amount of time.
I think the main problem is that we would probably need to find a version of EQ that is easily attainable. IMO, we have passed the point where Anniversary is a viable option, since it is about as hard to find as Titanium is. At this point, we would be best to wait until the next expansion (which is hopefully an all inclusive deal like Titanium or Anniversary) to come out. And ultimately it would be best if we could get some packet collects from live to help speed the process and to collect info on any new features that aren't in the current Emu code. But, for that to happen, we would need a good packet collector program ready by the time of the next EQ release.
I imagine it probably won't be too long before the next EQLive expansion, but I haven't heard anything about an upcoming one yet. If we do get wind that a new expansion is coming out, it might be nice to know early so we can maybe try to make some preparations to get ready for it. If we had to, I think we could just use wireshark for packet collects now and then make a tool to sort through and find the useful info from those collect afterwards.
I think the main thing is that we need a version of EQ that is easily attainable and hopefully can be bought in a store.
Congdar
09-09-2008, 09:18 AM
The next Live expansion is due at the end of October and will have Bots and is all inclusive with the 14 expansions.
ChaosSlayer
09-09-2008, 10:47 AM
umm there is plenty of Aniversary boxes left to go around.
they prabobly like $5 more than Titanium, but well worth it consiring all the extra content you get just counting new zones and new models
and new "all expansion" box will prabobly have a starting price of like $45
Andrew80k
09-09-2008, 02:51 PM
umm there is plenty of Aniversary boxes left to go around.
they prabobly like $5 more than Titanium, but well worth it consiring all the extra content you get just counting new zones and new models
and new "all expansion" box will prabobly have a starting price of like $45
They've been running around $30 dollars, but have been download only which means, of course, patched. So these are not really viable options unless we can get a good way of patching the server to the live client quickly and easily. Not impossible, but we are certainly not to that point yet.
There really aren't that many new features past titanium that are of too much interest at this point. Mostly it's just content. We really need the packet capture tool working again so we can easily capture the content and update the databases without all the folks going to herculean efforts to make it happen.
As always, IMHO.
ChaosSlayer
09-09-2008, 06:18 PM
mmm at $15, not new but its a boxed version - so no pathign problem
http://www.amazon.com/gp/offer-listing/B000OU66JU/ref=dp_olp_2
well content actualy far outweights the "features"
features you all need to code in emulator - and you knwo how logn that takes.
content - more zone for people to look at, and of course new models for mobs and weapons =)
not to mention new race (ugly imho, but their armor sets are nice)
trevius
09-09-2008, 06:39 PM
Chaos, you have to consider that potentially hundreds or maybe even thousands of people would need to have access to get the correct retail CDs. With used being one of the only options for Anniversary, I think the numbers would be far too limited, which is why I have completely given up on Anniversary Edition as being a viable option at this point. I will definitely be researching the new expansion pack that Congdar mentioned :)
Oh, and I just have to LOL if EQLive added Bots to the next expansion! I can only imagine that they got the idea from the emulator and maybe even used some of the code for it lol. If SoE was smart, they would use EQ as an experiment and actually make running your own server an option. Am I the only one who thinks that SoE could make insane amounts of cash if they allowed custom servers? All they would need to do is make the client so it can only connect to their login server and then just let people connect their own servers up to it similar to Neverwinter Nights custom servers. Hell, they could even still charge a reduced monthly fee of maybe 5$ a month and I am sure they would get an amazing amount of players back. I really hate to see an MMO die and EQLive definitely isn't increasing it's player numbers anymore. IMO, there is no excuse not to take a small risk and see if they can make a huge change to the MMO industry. I already even have most of the details worked out for exactly how they could set a system like this up. They could either have people host their own servers like we do in the emulator, or even better would be if SoE hosted them for us and let the server admins manage their "own" servers.
I wrote this a while back (and I was very careful to not even hint about the EQEmulator):
http://forums.station.sony.com/eq/posts/list.m?topic_id=130077
But it seems like most people there think it is a bad idea. But, I think they just don't understand how cool it really could be. Ahh well lol.
ChaosSlayer
09-09-2008, 06:42 PM
well I am all for the "new" expansion pack - as long as it works =)
soe has been known to release some expansion that were 100% do not work right out of the box - Luclin for exmaple was uterly broken
Congdar
09-09-2008, 08:37 PM
I vote for Sony releasing the Everquest code when they stop developing for it. Would be interesting to see how close the emulator code is and what goodness could be combined from the two source trees.
ChaosSlayer
09-09-2008, 08:49 PM
I vote for Sony releasing the Everquest code when they stop developing for it. Would be interesting to see how close the emulator code is and what goodness could be combined from the two source trees.
a soe president would rather hang himself that to give anything out for free =)
trevius
09-12-2008, 10:56 AM
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
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
void scribespells(int spell_level);
void traindiscs(int disc_level);
perlparser.cpp
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
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:
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.
KLS, I stickied this so you don't forget to add them into the next source update. If there are reasons not to add them, feel free to just unsticky. But, IMO, these seem like pretty good code additions/changes.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.