PDA

View Full Version : Bards and thier code changes


Zuesrooster
09-13-2006, 01:25 PM
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

if(spells[spell_id].skill == SINGING)
effectmod += 20*GetAA(aaSingingMastery);
else
effectmod += 20*GetAA(aaInstrumentMastery);

to

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
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

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.
:???:

vales
09-13-2006, 01:57 PM
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.

KLS
09-13-2006, 07:38 PM
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()

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()

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.

Zuesrooster
09-14-2006, 12:14 AM
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.

Zuesrooster
09-14-2006, 01:34 AM
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:

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.

Zuesrooster
09-14-2006, 12:13 PM
Tested it the only change is where it adds in the extra points for singing and instrument mastery it should be

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.

fathernitwit
09-20-2006, 06:15 PM
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.

Zuesrooster
09-25-2006, 12:01 PM
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

if(!UseBardSpellLogic())
InterruptSpell();