Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 06-19-2012, 09:23 AM
squevis667
Fire Beetle
 
Join Date: Dec 2010
Posts: 18
Default

Th issue was what list was being iterated over. As a side note, if you want to rez corpses, you have to iterate the corpse_list and not the mob_list. Code below for EntityList::AESpell fixed it.
Code:
void EntityList::AESpell(Mob *caster, Mob *center, int16 spell_id, bool affect_caster, sint16 resist_adjust)
{
	if(!IsAERezSpell(spell_id))
	{
		LinkedListIterator<Mob*> iterator(mob_list);
		Mob *curmob;
	
		float dist = caster->GetAOERange(spell_id);
		float dist2 = dist * dist;
	
		bool bad = IsDetrimentalSpell(spell_id);
		bool isnpc = caster->IsNPC();
		const int MAX_TARGETS_ALLOWED = 4;
		int iCounter = 0;
	
		for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
		{
			curmob = iterator.GetData();
			if(curmob == center)	//do not affect center
				continue;
			if(curmob == caster && !affect_caster)	//watch for caster too
				continue;
			if(center->DistNoRoot(*curmob) > dist2)	//make sure they are in range
				continue;
			if(isnpc && curmob->IsNPC()) {	//check npc->npc casting
				FACTION_VALUE f = curmob->GetReverseFactionCon(caster);
				if(bad) {
					//affect mobs that are on our hate list, or
					//which have bad faction with us
					if( ! (caster->CheckAggro(curmob) || f == FACTION_THREATENLY || f == FACTION_SCOWLS) )
						continue;
				} else {
					//only affect mobs we would assist.
					if( ! (f <= FACTION_AMIABLE))
						continue;
				}
			}
			//finally, make sure they are within range
			if(bad) {
				if(!caster->IsAttackAllowed(curmob, true))
					continue;
				if(!center->CheckLosFN(curmob))
					continue;
			}

			//if we get here... cast the spell.
			if(IsTargetableAESpell(spell_id) && bad) 
			{
				if(iCounter < MAX_TARGETS_ALLOWED)
				{
					caster->SpellOnTarget(spell_id, curmob, false, true, resist_adjust);
				}
			}
			else
			{
				caster->SpellOnTarget(spell_id, curmob, false, true, resist_adjust);
			}

			if(!isnpc) //npcs are not target limited...
				iCounter++;
		}	
	} 
	else
	{
		LinkedListIterator<Corpse*> iterator(corpse_list);
		Corpse *curcorpse;
	
		float dist = caster->GetAOERange(spell_id);
		float dist2 = dist * dist;

		for(iterator.Reset(); iterator.MoreElements(); iterator.Advance())
		{
			curcorpse = iterator.GetData();
			if(!curcorpse->IsPlayerCorpse())
				continue;
			if(center->DistNoRoot(*curcorpse) > dist2)	//make sure they are in range
				continue;
			
			caster->SpellOnTarget(spell_id, curcorpse);
		}
	}
}
Reply With Quote
Reply

Thread Tools
Display Modes

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