Spell Status Issue

EQ2Emulator Development forum.

Moderator: Team Members

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

Spell Status Issue

Post by Ememjr » Thu Apr 25, 2019 5:55 am

i have notice as well as others that spells on the hotbars dont always show like they should
ie
in queued state when should not be
dark when should be lit up etc
well this is apparently controlled by things like Unlockspell, lockspell, queue and unqueue

and those commands change the spell->status which is a bit map byte so the bit for queue appears to be bit 2 (value 4)
so if you have a status of 0 and want the spell to show queued you set status to 4
now here lies the problem

Code: Select all

void Player::ModifySpellStatus(SpellBookEntry* spell, sint16 value, bool modify_recast, int16 recast) {
	if (modify_recast) {
		spell->recast = recast;
		spell->recast_available = Timer::GetCurrentTime2()	+ (recast * 100);
	}

	if (modify_recast || spell->recast_available <= Timer::GetCurrentTime2() || value == 4)
		spell->status += value;
}
this modifie the status if the value is 4 it will ADD 4 to the current status, but wait theres more
if queuespell get called again it will add 4 more and make it status 8 which it should not be doing
should this not be doing something to set the bits adding or substacting a value

tyrbo
Team Member
Posts: 271
Joined: Thu Feb 18, 2016 12:33 pm

Re: Spell Status Issue

Post by tyrbo » Thu Apr 25, 2019 2:38 pm

This is another thing I addressed a long time ago.

I changed my code as follows:

The following functions were added for spell status.

Code: Select all

void Player::AddSpellStatus(SpellBookEntry* spell, sint16 value) {
  if (!(spell->status & value))
    spell->status += value;
}

void Player::RemoveSpellStatus(SpellBookEntry* spell, sint16 value) {
  if (spell->status & value)
    spell->status -= value;
}

Code: Select all

#define SPELL_STATUS_LEARNED 1
#define SPELL_STATUS_ENABLED 2
#define SPELL_STATUS_QUEUED 4
#define SPELL_STATUS_UNKNOWN4 8
#define SPELL_STATUS_UNKNOWN5 16
#define SPELL_STATUS_UNKNOWN6 32
#define SPELL_STATUS_READY 64
#define SPELL_STATUS_UNKNOWN7 128
and then we can add and remove status as necessary.

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

Re: Spell Status Issue

Post by Ememjr » Thu Apr 25, 2019 3:07 pm

thats basically the same thing i added, just didnt know what the 2 was

tyrbo
Team Member
Posts: 271
Joined: Thu Feb 18, 2016 12:33 pm

Re: Spell Status Issue

Post by tyrbo » Thu Apr 25, 2019 6:25 pm

Can't say I'm sure what the 1 and 2 are for. Just guessing when I set that up.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests