Added IsBuffSpell(spell_id). This will return true if the spell would end up having a duration, which will mean it would end up in one of the many buff windows on the client. This just makes sure the spell has a buffduration or buffdurationformula, which means the calculation will return a duration

Replaced all instances of CalcBuffDuration being used to determine if a spell was a buff with IsBuffSpell
Removed Mob::HasBuffIcon since it does the same thing IsBuffSpell does in a more convoluted way and had a rather missing leading name
Fixed issues that arose from the 10/03/2013 changes
This commit is contained in:
Michael Cook 2013-10-08 17:24:07 -04:00
parent 24308aec6c
commit 9a19a00bdc
8 changed files with 19 additions and 15 deletions

View File

@ -1,5 +1,11 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 10/08/2013 ==
demonstar55: Added IsBuffSpell(spell_id) that will return true if the spell has a duration, so would end up in effects/song/discs etc windows on the client
demonstar55: Replaced instances of using CalcBuffDuration to determine if a spell was a buff with IsBuffSpell
demonstar55: Removed Mob::HasBuffIcon since it was doing what IsBuffSpell does in a more convoluted way with a rather misleading name
demonstar55: Fixed issues that arose from the 10/03/2013 change
== 10/05/2013 ==
Sorvani: fixed issue with stackable items being created with 0 charges cause by fix to SummonItems

View File

@ -987,6 +987,13 @@ bool IsSelfConversionSpell(uint16 spell_id) {
return false;
}
// returns true for both detrimental and beneficial buffs
bool IsBuffSpell(uint16 spell_id) {
if(IsValidSpell(spell_id) && (spells[spell_id].buffduration || spells[spell_id].buffdurationformula))
return true;
return false;
}
uint32 GetMorphTrigger(uint32 spell_id)
{
for(int i = 0; i < EFFECT_COUNT; ++i)

View File

@ -792,6 +792,7 @@ bool IsGroupHealOverTimeSpell(uint16 spell_id);
bool IsDebuffSpell(uint16 spell_id);
bool IsResistDebuffSpell(uint16 spell_id);
bool IsSelfConversionSpell(uint16 spell_id);
bool IsBuffSpell(uint16 spell_id);
uint32 GetMorphTrigger(uint32 spell_id);
uint32 GetPartialMeleeRuneReduction(uint32 spell_id);
uint32 GetPartialMagicRuneReduction(uint32 spell_id);

View File

@ -9329,7 +9329,7 @@ int32 Bot::GetActSpellCasttime(uint16 spell_id, int32 casttime) {
|| botclass == PALADIN || botclass == BEASTLORD ))
cast_reducer += (GetLevel()-50)*3;
if((casttime >= 4000) && BeneficialSpell(spell_id) && ((CalcBuffDuration(this,this,spell_id)-1) > 0)) {
if((casttime >= 4000) && BeneficialSpell(spell_id) && IsBuffSpell(spell_id)) {
switch (GetAA(aaSpellCastingDeftness)) {
case 1:
cast_reducer += 5;

View File

@ -3033,15 +3033,6 @@ void Mob::SetDeltas(float dx, float dy, float dz, float dh) {
delta_heading = static_cast<int>(dh);
}
bool Mob::HasBuffIcon(Mob *caster, Mob *target, uint16 spell_id)
{
if((caster->CalcBuffDuration(caster, target, spell_id)-1) > 0)
return true;
else
return false;
}
void Mob::SetEntityVariable(const char *id, const char *m_var)
{
std::string n_m_var = m_var;

View File

@ -241,7 +241,6 @@ public:
int16 GetBuffSlotFromType(uint16 type);
uint16 GetSpellIDFromSlot(uint8 slot);
int CountDispellableBuffs();
bool HasBuffIcon(Mob* caster, Mob* target, uint16 spell_id);
bool CheckHitsRemaining(uint32 buff_slot, bool when_spell_done=false, bool negate=false,uint16 type=0,
uint16 spell_id=0, bool use_skill=false,uint16 skill=0);
void SpreadVirus(uint16 spell_id, uint16 casterID);

View File

@ -82,7 +82,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
if(c_override)
{
int durat = CalcBuffDuration(caster, this, spell_id, caster_level);
if((durat-1) > 0)
if(durat > 0)
{
buffslot = AddBuff(caster, spell_id, durat, caster_level);
if(buffslot == -1) // stacking failure
@ -95,7 +95,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
}
else
{
if((CalcBuffDuration(caster,this,spell_id)-1) > 0){
if(IsBuffSpell(spell_id)){
if(IsEffectInSpell(spell_id, SE_BindSight))
{
if(caster)

View File

@ -2257,7 +2257,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) {
{
if(IsClient())
{
if(HasBuffIcon(caster, this, spell_id) == false)
if(!IsBuffSpell(spell_id))
{
CastToClient()->SetKnockBackExemption(true);
@ -3497,7 +3497,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r
{
if(spelltar->IsClient())
{
if(HasBuffIcon(this, spelltar, spell_id) == false)
if(!IsBuffSpell(spell_id))
{
spelltar->CastToClient()->SetKnockBackExemption(true);