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 09-13-2006, 01:25 PM
Zuesrooster
Fire Beetle
 
Join Date: Mar 2006
Location: NYC
Posts: 20
Default Bards and thier code changes

Made a couple of code changes to try and improve bards.

To make the Singing Mastery AA skill work I changed to client_mods.cpp
Line 1353 changed from
Code:
	if(spells[spell_id].skill == SINGING)
		effectmod += 20*GetAA(aaSingingMastery);
	else
		effectmod += 20*GetAA(aaInstrumentMastery);
to
Code:
	if(IsClient())
	{
		if(spells[spell_id].skill == SINGING)
			effectmod += 20*this->CastToClient()->GetAA(aaSingingMastery);
		else
			effectmod += 20*this->CastToClient()->GetAA(aaInstrumentMastery);
	}
then in bonuses.cpp changed

ApplySpellsBonuses(buffs[i].spellid, buffs[i].casterlevel, newbon);

to

ApplySpellsBonuses(buffs[i].spellid, buffs[i].casterlevel, newbon, buffs[i].casterid);

and line 336-348 from
Code:
void Mob::ApplySpellsBonuses(int16 spell_id, int8 casterlevel, StatBonuses* newbon)
{
	int i, effect_value;

	if(!IsValidSpell(spell_id))
		return;

	for (i = 0; i < EFFECT_COUNT; i++)
	{
		if(IsBlankSpellEffect(spell_id, i))
			continue;

		effect_value = CalcSpellEffectValue(spell_id, i, casterlevel);
to

Code:
void Mob::ApplySpellsBonuses(int16 spell_id, int8 casterlevel, StatBonuses* newbon)
{
	ApplySpellsBonuses(spell_id,casterlevel, newbon, 0);
}

void Mob::ApplySpellsBonuses(int16 spell_id, int8 casterlevel, StatBonuses* newbon, int casterId)
{
	Mob* caster;
	int i, effect_value;

	if(casterId > 0) // save some time looping through all the entities
		caster = entity_list.GetClientByID(casterId);
	else 
		caster = NULL;

	if(!IsValidSpell(spell_id))
		return;

	for (i = 0; i < EFFECT_COUNT; i++)
	{
		if(IsBlankSpellEffect(spell_id, i))
			continue;

		effect_value = CalcSpellEffectValue(spell_id, i, casterlevel,caster);
I had to pass in the casterid to see if the caster still has an instrument equiped. To get the right bonuses.

I did my test with buffs, and these changes made instruments and at least the singing mastery work as far as calculating numbers on the server. The client still has the wrong numbers. Also another strange thing I noticed is on the BardPulse method in spells.cpp when it sends the action packet the numbers on the client increase, they don't match the server numbers and they increase whether or not you have an instrument equiped. I don't know if this happens for everyone, and I know bards are always broken, so nothing new. I am guessing that the bonuses the server calculates is not the one the client uses and the client calculates its own. I don't know if anyone has anymore insite why the client woudl refuse to believe my drum is a drum but any tips would be appreciated.
Reply With Quote
  #2  
Old 09-13-2006, 01:57 PM
vales
Discordant
 
Join Date: May 2006
Posts: 458
Default

Maybe it has something to do with having to equip the instruments in the secondary slot?

This is awesome, btw. Finally, some recognition for bards, hehe.
Reply With Quote
  #3  
Old 09-13-2006, 07:38 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

The issue with it not appearing client side seems to be with the sending of the Action_Struct packet.

I looked through the code and found two points of interest:

in in Mob::SpellOnTarget()
Code:
action->spell = spell_id;
action->sequence = (int32) (GetHeading() * 2);	// just some random number
action->unknown06 = 0x0A;	// seems to always be 0x0A (10)
and in Mob::BardPulse()
Code:
action->spell = spell_id;
action->sequence = (int32) (GetHeading() * 2);	// just some random number
action->unknown06 = 0x10;		// seems to always be 0x0A (10)
First of all there's a typo in the unknown06 entry, 0x10 is 16 not 10, which also led me to the conclusion that it isn't supposed to always be ten but rather that it is the bard modifier the client uses. At least this appears to be the case with the titanium client I'm using, I change that and the numbers on the client changes. Try changing that to use the instrument modifier and see what you get.
Reply With Quote
  #4  
Old 09-14-2006, 12:14 AM
Zuesrooster
Fire Beetle
 
Join Date: Mar 2006
Location: NYC
Posts: 20
Default

Your right! Thanks I replaced the 0x0A and the 0x10 with

action->unknown06 = GetInstrumentMod(spell_id);


and that did the trick! The numbers now match the server numbers as far as instrumnets mods go. Though they do seam a little of. I think how much you get per AA or the instrument mods is to high. if you have 3 skill in Singing mastery your singing songs get 6 TIMES as strong. I don't remember that on my eqlive bard. But at least instrument modifiers seam to be working. Thanks again.
Reply With Quote
  #5  
Old 09-14-2006, 01:34 AM
Zuesrooster
Fire Beetle
 
Join Date: Mar 2006
Location: NYC
Posts: 20
Default

I am doing this at work so I haven't really had a chance to test it out but I am 90% sure that replacing GetInstrumentMod with:

Code:
	if(GetClass() != BARD)
		return(10);
	
	int16 effectmod = 100;
	
	//this should never use spell modifiers...
	//if a spell grants better modifers, they are copied into the item mods
	//because the spells are supposed to act just like having the intrument.
	
	//item mods are in 10ths of percent increases
	switch(spells[spell_id].skill) {
		case PERCUSSION_INSTRUMENTS:
			if(itembonuses.percussionMod > spellbonuses.percussionMod)
				effectmod += itembonuses.percussionMod;
			else
				effectmod += spellbonuses.percussionMod;
			break;
		case STRINGED_INSTRUMENTS:
			if(itembonuses.stringedMod > spellbonuses.stringedMod)
				effectmod += itembonuses.stringedMod;
			else
				effectmod += spellbonuses.stringedMod;
			break;
		case WIND_INSTRUMENTS:
			if(itembonuses.windMod > spellbonuses.windMod)
				effectmod += itembonuses.windMod;
			else
				effectmod += spellbonuses.windMod;
			break;
		case BRASS_INSTRUMENTS:
			if(itembonuses.brassMod > spellbonuses.brassMod)
				effectmod += itembonuses.brassMod;
			else
				effectmod += spellbonuses.brassMod;
			break;
		case SINGING:
			if(itembonuses.singingMod > spellbonuses.singingMod)
				effectmod += itembonuses.singingMod;
			else
				effectmod += spellbonuses.singingMod;
			break;
		default:
			break;
	}
	
	if(spells[spell_id].skill == SINGING)
		effectmod += 20*GetAA(aaSingingMastery);
	else
		effectmod += 20*GetAA(aaInstrumentMastery);
	
	#if EQDEBUG >= 5
//		LogFile->write(EQEMuLog::Debug, "%s::GetInstrumentMod() spell=%d mod=%d\n", GetName(), spell_id, effectmod);
	#endif
	return(effectmod/10);
this should get instrument modifiers working like live. The issue with the old one is if a weapon had a 21% modifier it actually increased it by 2.1 times instead of .21, this will only increase it 20% since it is an int and for some reason it is expecting 10 instead of a 100 as the mod. But it gets instruments working much closer to live then before. I will play around some more with it this week or next week, if anyone has any ideas they are always welcome.

Last edited by Zuesrooster; 09-14-2006 at 10:28 AM..
Reply With Quote
  #6  
Old 09-14-2006, 12:13 PM
Zuesrooster
Fire Beetle
 
Join Date: Mar 2006
Location: NYC
Posts: 20
Default

Tested it the only change is where it adds in the extra points for singing and instrument mastery it should be

Code:
if(IsClient())
	{
		if(spells[spell_id].skill == SINGING)
			effectmod += 20*this->CastToClient()->GetAA(aaSingingMastery);
		else
			effectmod += 20*this->CastToClient()->GetAA(aaInstrumentMastery);
	}
as stated on the first message, it only mods it by increments of 10%. Tried playing around with the struct, different values nothing i could make sense of resulted.
Reply With Quote
  #7  
Old 09-20-2006, 06:15 PM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

hey, overall good job spotting this hole in the bard code. I will get most of it in.

I dont think your AA changes are needed, since GetAA is a virtual function, theres no need to cast to client to get the right version of GetAA called... unless you can prove me wrong.
Reply With Quote
  #8  
Old 09-25-2006, 12:01 PM
Zuesrooster
Fire Beetle
 
Join Date: Mar 2006
Location: NYC
Posts: 20
Default

All I know is when stepping through it, it called the Mob function instead of the client method. Wasn't binding to the right method, I haven't programmed much in C++ and consider myself a beginner in the language, so I can't really prove why you had to, just that I had to to make it work. Its very possible its something else that i might have done wrong.

Another Bard fix I tested in EQLive and crouching did not stop my singing so in client_packet.cpp Line #1689 I changed to

Code:
			if(!UseBardSpellLogic())
				InterruptSpell();

Last edited by Zuesrooster; 09-25-2006 at 08:11 PM..
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 03:53 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