Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 06-14-2013, 12:19 PM
noudess
Discordant
 
Join Date: Sep 2012
Location: Upstate NY
Posts: 274
Default

It will indeed retain the value, but that value will never be negative unless it's assigned into a signed variable somewhere down the line.

Anything stored in a uint32 var will never pass (if var > 0) unless manually casted up or assigned into a signed variable.

The spots where it is being passed in as the 0xFFFFFFF value assign it to casting_spell_inventory_slot.

If you check the code, and step through spell casting, it checks every single spell as if it was cast from an inventory slot because the value is > 0.

That's how I found the problem. The spell code was running through "cast from spell slot" every time.
It never found a match, since no slot was numbered 0xFFFFFFF but it seems like a waste of time.

I don't think that's the intent, unless the 0xFFFFFFF value is just meant to be non-zero.

This is the code I found in spell_effects.cpp that always executes.

GetCastedSpellInvSlot() always returns a large number when the default arguments from all the way back at CastSpell() is 0xFFFFFFF instead of 0.

SpellEffect() code below. GetCastedSpellInvSlot() returns unsigned as well. As a whole, if negative numbers are desired, Id change all the types to signed for that value, but that's a great many changes in this case. As far as I can tell, 0 as well as -1 are both invalid slots. Certainly the code below thinks so, it does not execute if its 0, but does run though the code checking for matches when its 0xFFFFFFF (or a very large value in this case).

The charm slot thing is disturbing, as then this code doesn't work for that, unaltered... Unless that is not used when casting... but it seems like it would be.

Code:
   if(caster && caster->IsClient() && GetCastedSpellInvSlot() > 0)^M
    {^M
        const ItemInst* inst = caster->CastToClient()->GetInv().GetItem(GetCastedSpellInvSlot());^M
        if(inst)^M
        {^M
            if(inst->GetItem()->Click.Level > 0)^M
            {^M
                caster_level = inst->GetItem()->Click.Level;^M
                c_override = true;^M
            }^M
            else^M
            {^M
                caster_level = caster ? caster->GetCasterLevel(spell_id) : GetCasterLevel(spell_id);^M
            }^M
        }^M
        else^M
            caster_level = caster ? caster->GetCasterLevel(spell_id) : GetCasterLevel(spell_id);^M
    }^M
Reply With Quote
 


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 08:25 PM.


 

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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3