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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-31-2009, 12:27 AM
VallonTallonZek
Sarnak
 
Join Date: May 2008
Location: Halas
Posts: 42
Default GetBuffSlotFromType issue

In the current stock source the function GetBuffSlotFromType accepts an int8 and returns a sint8 (-1 is used as not found).

The issue is that effectid is defined as an int, so if you create a new spell effect type with a index of higher than 255 loops it back around. In my case I passed in a new effect with a value of 344 and it turned it into 88 for purposes of the function.

All I did was bring it up to int16 because I figure 65,000+ spell effects is probably good enough when the highest the stock source goes up to is 360.

Here is the fix:


mob.cpp
Code:
sint8 Mob::GetBuffSlotFromType(int8 type) {
	for (int i = 0; i < BUFF_COUNT; i++) {
		if (buffs[i].spellid != SPELL_UNKNOWN) {
			for (int j = 0; j < EFFECT_COUNT; j++) {
				if (spells[buffs[i].spellid].effectid[j] == type ) {
					return i;
				}
			}
		}
	}
    return -1;
}
to

Code:
sint16 Mob::GetBuffSlotFromType(int16 type) {
	for (int i = 0; i < BUFF_COUNT; i++) {
		if (buffs[i].spellid != SPELL_UNKNOWN) {
			for (int j = 0; j < EFFECT_COUNT; j++) {
				if (spells[buffs[i].spellid].effectid[j] == type ) {
					return i;
				}
			}
		}
	}
    return -1;
}
and

mob.h
Code:
sint8	GetBuffSlotFromType(int8 type);
to

Code:
sint16	GetBuffSlotFromType(int16 type);
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 08:41 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3