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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-21-2012, 09:48 AM
squevis667
Fire Beetle
 
Join Date: Dec 2010
Posts: 18
Default Group Buff Targeting and TGB

I have noticed that when casting buffs that are target type 42 with TGB enabled when I have members of my own group targeted was resulting in a "Target not in range" message. If I turn off TGB it goes away. I dug into the targeting logic in spells.cpp and I noticed it was trying to set the target to my target and not use me as the target. It is my guess that somewhere in the EMU, it is not allowing me to target a group member and cast a Group v2 spell. So I wrote a quick function for Client::IsInMyGroup(Client* client) and added it to group.cpp
Code:
bool Client::IsInMyGroup(Client* client)
{
	if(!(this->HasGroup()))
		return false;
	Group* g = this->GetGroup();
	for(int i = 0; i < g->GroupCount(); i++)
	{
		if(g->members[i]->CastToClient() == client)
			return true;
	}
	return false;
}
I then changed the targeting logic so that if the caster is a client, TGB is on, the spell can use TGB, the target is a client, and (finally) the target is in my group, it will use the caster as the target of the spell and you no longer get an error message.
Code:
case ST_GroupTeleport:
		case ST_Group:
		{
			if(IsClient() && CastToClient()->TGB() && IsTGBCompatibleSpell(spell_id)) {
				if( (!target) || 
					(target->IsNPC() && !(target->GetOwner() && target->GetOwner()->IsClient())) ||
					(target->IsCorpse()) ||
					(target->IsClient() && this->CastToClient()->IsInMyGroup(target->CastToClient()))) // added by squevis667
					spell_target = this;
				else
					spell_target = target;
			} else {
				spell_target = this;
			}
			CastAction = GroupSpell;
			break;
		}
I guess the other option is to dig down into whatever logic is throwing the message to begin with (you should be able to cast a spell with TGB on a group member without an error), so this is more of a quick fix and does not really address the root cause.
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:36 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