Page 1 of 1

Deleveling

Posted: Sat Jun 04, 2016 1:24 pm
by Gangrenous
I notice when you de-level you never lose your spells and can cast them at any level. Testing, make yourself level 60, get your spells and then de-level to 1 and you can still cast your 60 spells.

Re: Deleveling

Posted: Sat Jun 04, 2016 4:00 pm
by Jabantiz
I don't think we ever added any support for removing spells, also with EQ2's death penalty it was impossible to loose a level as you never lost xp you just got that debt. Thinking about this would we really want to remove the spells from the player or hide them, cause if they got a level and scribed a master tier spell then lost the level it would suck for them to loose that spell.

Re: Deleveling

Posted: Sat Jun 04, 2016 5:35 pm
by Gangrenous
I will have to on my end, it may not be needed on the official source. Disable the spell that is, not remove it.

Re: Deleveling

Posted: Sun Jun 05, 2016 8:36 am
by Gangrenous
I noticed that when you level it iterates through all your spells and if new ones are found it just adds them.
Does this actually lock a spell from being cast (greys it out)?

Code: Select all

Player::LockSpell(Spell* spell, int16 recast)
If so would this be a viable method of disabling them?

Re: Deleveling

Posted: Sun Jun 05, 2016 9:15 am
by Gangrenous
Okay I got it, just an else statement and moving some code around. I am going to create a rule on my end to disable them on de-leveling. Also on

Code: Select all

ModifySpellStatus(0, 66, true);
What is the significance on the 66 versus -66?

Re: Deleveling

Posted: Sun Jun 05, 2016 4:07 pm
by Jabantiz
Couldn't tell you, 66 is just a magic number that we got from packets to make it work, we haven't been able to figure out anything else outside of the packets, I had assumed it was a bitmask but tests on that a ways back didn't result in anything useful. As for -66 it just removes the value, basically restoring it to default after 66 was used.

Re: Deleveling

Posted: Mon Jun 06, 2016 6:35 am
by Gangrenous
Well I should say this is almost working, almost. The first time I set my level, lets say level 8, I have my level 8 spells and anything higher level shows as disabled. If I set my level again I have all spells. If I set it one more time I have just my level 8 spells. It is strange. I have went through the code twice and nothing is just jumping out at me so I am thinking it is something I am not understanding about the spells. I actually wrote my own routines and left the original routines intact. Basically I am looping through all the spells and checking to see if the player has the spell. If the player has the spell I am disabling the spell when the spell is above his level, otherwise I enable the spell. Thoughts?

Re: Deleveling

Posted: Mon Jun 06, 2016 3:49 pm
by Jabantiz
Off the top of my head I would suggest putting level checks in the spell book packet and if the spell level is higher then the player level skip it so it doesn't show in the spell book, if it doesn't show in the spell book then the player shouldn't be able to cast it. This is just in theory though, as the spell book packet is an update packet by just skipping the spell might not remove it from the spell book.

As for your method, when you use modify it adds the value, so if you are level 9 and do /level 8 it will disable the spells, if you then do /level 7 and you just use modify again with out checking if they are already disable it will add the value on top and probably enable the lvl 9 spells while disabling the lvl 8 spells. That is my best guess at least from what you described.

Re: Deleveling

Posted: Fri Jun 24, 2016 4:23 pm
by Gangrenous
Jabantiz wrote: putting level checks in the spell book packet a.
Can you give me a quick direction on where to find this? I might revisit this tonight.

Re: Deleveling

Posted: Fri Jun 24, 2016 5:46 pm
by Jabantiz
In player.cpp, this function

Code: Select all

EQ2Packet* Player::GetSpellBookUpdatePacket(int16 version){
The main thing is count needs to be the total number of spells being sent in the packet so you would need to filter out the ones of a higher level first before the if (count > 0)

This is also an update packet so there is no guarantee it will work.