BUG: Spells not getting marked as scribable

Old bugs stored here for reference.
Locked
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

BUG: Spells not getting marked as scribable

Post by Ememjr » Mon Apr 08, 2019 4:27 am

when you right click a spell to scribe it the scribe option is missing
the following items were checked

1.in the code where menu_type is set, the item type checked out
2. next step is to check if ScribeAllowed
a. check ADV class or TS class Match
b. and then check level

the level check is not passing, the spell Incinerate II (Adept) is level 17

here is the code with some added troubleshooting information.

mylevel is 20
spelllevels = 170
so this part of if fails

Code: Select all

player->GetLevel() >= levels[i]->spell_level

so it would seem that the levels(i) has been populated incorrectly somewhere but where

i could just do a divide by 10 here but that is not the solution or is it


Code: Select all

bool Spell::ScribeAllowed(Player* player){
	bool ret = false;
	if(player){
		MSpellInfo.lock();
		for(int32 i=0;!ret && i<levels.size();i++){
			int16 mylevel = player->GetLevel();
			int16 spelllevels = levels[i]->spell_level;
			bool advlev = player->GetAdventureClass() == levels[i]->adventure_class;
			bool tslev = player->GetTradeskillClass() == levels[i]->tradeskill_class;
			bool levelmatch = player->GetLevel() >= levels[i]->spell_level;
			if((player->GetAdventureClass() == levels[i]->adventure_class || player->GetTradeskillClass() == levels[i]->tradeskill_class) && player->GetLevel() >= levels[i]->spell_level)
				ret = true;
		}
		MSpellInfo.unlock();
	}
	return ret;
}

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: BUG: Spells not getting marked as scribable

Post by Ememjr » Mon May 06, 2019 4:19 am

after reviewing code for the spells, i will retract my statement on saying dividing the spell level by 10 was not a good idea

in fact it is the proper way, since the client is actually using spell level * 10 ie s level 17 spell the client received 170

the proper way to determine the spell level from code then is to divide by 10

i believe i have fixed and committed this code already

Code: Select all

if((player->GetAdventureClass() == levels[i]->adventure_class || player->GetTradeskillClass() == levels[i]->tradeskill_class) && player->GetLevel() >= levels[i]->spell_level)
change to this

Code: Select all

if((player->GetAdventureClass() == levels[i]->adventure_class || player->GetTradeskillClass() == levels[i]->tradeskill_class) && player->GetLevel() >= levels[i]->spell_level/10)
in spells.cpp within the ScribeAllowed Function

committed to SVN in REV # 2823

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: BUG: Spells not getting marked as scribable

Post by Gangrenous » Mon May 06, 2019 9:24 am

Resident Dirty Hippy

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: BUG: Spells not getting marked as scribable

Post by Ememjr » Mon May 06, 2019 10:28 am

i did not see that post / but i am glad that great minds think alike and we came upwtih the same fix

this is just another example of where fixes would be posted but no ever added to code and committed

now i just commit it myself, now if we could just get the rights back to server so Jab or cynarr can compile

User avatar
Eradani
Posts: 192
Joined: Wed May 05, 2010 6:25 am
Location: Saskatchewan

Re: BUG: Spells not getting marked as scribable

Post by Eradani » Sun Jun 30, 2019 2:20 pm

followed this all the way through and have one question. plz forgive me if this is in any way a "stupid" question

what is levels[] with respect to TheSpell that calls ScribeAllowed() ?
to me, it looks like it is a property of TheSpell but then why is it an array. for that matter, it seems to be an object holding all the properties of TheSpell instead of TheSpell just holding them but i still don't get why it's an array. what am i missing?

in javascript, the object calling the function would be referenced by "this" in the function. for instance in TheSpell->ScribeAllowed(...) "this" would refer to the TheSpell object

having said that, my understanding is

Code: Select all

bool Spell::ScribeAllowed(Player* player){
	bool this->allowed = false;
	if(player)
	{
		MSpellInfo.lock();
		if(
			(	player->GetAdventureClass() == this->adventure_class 
			||	player->GetTradeskillClass() == this->tradeskill_class
			) && 
				player->GetLevel() >= (this->spell_level/10)
		)
			this->allowed = true;
		MSpellInfo.unlock();
	}
	return this->allowed; // we return the value as a courtesy to calling code
}
anything that i can guess about levels[] seems wrong so i am lost
my client version: 12682L, 2016/06/06
last one that will run on XP cause i'm just a stick-in-the-mud

Locked

Who is online

Users browsing this forum: No registered users and 0 guests