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)

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2014, 01:23 AM
Bonehard
Fire Beetle
 
Join Date: Feb 2011
Posts: 16
Default Client::OPMemorizeSpell

Hello all,
first i'am not sure where to post this under wich dev section.
So feel free to move to the correct section.

I'am working on some code and have find a strange bug and not sure where this comes from.

I have add some code to the Client::OPMemorizeSpell function.
Code:
	// Custom - Used for disabling scribes more than given number
	if (disableScribe)
	{
		// Count scribed spells
		int iScribed = 0;
		for (int i = 0; i < MAX_PP_SPELLBOOK; i++)
		{
			if (m_pp.spell_book[i] != 0xFFFFFFFF)
				iScribed++;
		}

		// check if we reached the maximum client can scribe spells
		if (iScribed >= numMaxScribeSpells)
		{
			Message(13, "Maximum spells scribed. Please unscripe some spells.");
			return;
		}
	}
The code is very simple it checks just if the user can scribe a spell or max number is reached. For example i disable scribing after 10 spells so that the user will get the message above.

The code works so far when a user tries to scribe a spell and reached the maximum scribe number he gets this message and the spells will not be scribed.

So far so good.
But on the client something strange happend.
The user get the info from server spell is not scribed but the gui is not responding anymore.
I can't click on npc's or door's.
Keys also don't work anymore so i cant open any windows like inventory.
I can open dialogs like inventory only over the menu.
Buttons stills works but it seems the gui is not responding anymore to hotkeys.
If i open one of the dialogs like inventory over the menu it shows up but it takes no input from mouse.
This happend to any menu i call over the menu.
I can click into the chat input window and still can type some commands.
So when i use the #zone command to leave the zone the gui seems to work like it should.
It only happend when i try to use the custom code i posted above.

Some more infos:
I compile under windows with visual studion 2013 in X64 mode.

The client iam testing at the moment is underfoot(steam).

Thanks in advance!!!
(Going to work now. Maybe i can respond later from work.)
Reply With Quote
  #2  
Old 06-10-2014, 01:56 AM
Zaela_S
Hill Giant
 
Join Date: Jun 2012
Posts: 216
Default

Total guess, but the client probably assumes scribing will succeed under normal circumstances and gets stuck in scribe-mode waiting for a packet.

I would try:

Code:
UnscribeSpell(memspell->slot, true);
Sends a delete-from-spellbook packet to the client. It may accept that as a failure to scribe.

Alternatively:

Code:
MemorizeSpell(memspell->slot, 0xFFFFFFFF, memSpellScribing);
Sends the success packet the client expects. Not sure if the client would consider 0xFFFFFFFF to be an invalid spellid the way we do, though...

I am moderately confident that the first one might work.
Reply With Quote
  #3  
Old 06-10-2014, 09:55 AM
Bonehard
Fire Beetle
 
Join Date: Feb 2011
Posts: 16
Default

Quote:
Originally Posted by Zaela_S View Post
Total guess, but the client probably assumes scribing will succeed under normal circumstances and gets stuck in scribe-mode waiting for a packet.

I would try:

Code:
UnscribeSpell(memspell->slot, true);
Sends a delete-from-spellbook packet to the client. It may accept that as a failure to scribe.

Alternatively:

Code:
MemorizeSpell(memspell->slot, 0xFFFFFFFF, memSpellScribing);
Sends the success packet the client expects. Not sure if the client would consider 0xFFFFFFFF to be an invalid spellid the way we do, though...

I am moderately confident that the first one might work.
Heya,
i will check this later at home when iam back from work.
Reply With Quote
  #4  
Old 06-10-2014, 01:19 PM
Bonehard
Fire Beetle
 
Join Date: Feb 2011
Posts: 16
Default

Hello,
it works now.
But you need to answer with the MemorizeSpell(memspell->slot, 0xFFFFFFFF, memSpellScribing).
I think it has to do with the fact that when the client wants to write a valid spell to the spellbook it send the packet for scribing a spell.
So you need to answer with the correct packet i think.

Code:
	// Custom - Used for disabling scribes more than given number
	if (disableScribe)
	{
		// Count scribed spells
		int iScribed = 0;
		for (int i = 0; i < MAX_PP_SPELLBOOK; i++)
		{
			if (m_pp.spell_book[i] != 0xFFFFFFFF)
				iScribed++;
		}

		// check if we reached the maximum client can scribe spells
		if (iScribed >= numMaxScribeSpells)
		{
			MemorizeSpell(memspell->slot, 0xFFFFFFFF, memSpellScribing);
			Message(13, "Maximum spells scribed. Please unscripe some spells.");
			return;
		}
	}
This works now like i wanted.
The only side effect is that you see the answer unknown spell written etc...

But thats ok since i can send the information to the client whats the real problem.

Thank you very much for the nice hint Zaela_S.
Reply With Quote
Reply


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 11:39 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