View Single Post
  #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