Change item effects to int32

Check range on AEDuration spells
This commit is contained in:
Natedog2012 2017-04-23 01:57:08 -07:00
parent cfd7e9f4d3
commit 36be32f36f
2 changed files with 22 additions and 1 deletions

View File

@ -332,7 +332,7 @@ namespace EQEmu
}; };
struct ItemEffect_Struct { struct ItemEffect_Struct {
int16 Effect; int32 Effect;
uint8 Type; uint8 Type;
uint8 Level; uint8 Level;
uint8 Level2; uint8 Level2;

View File

@ -2140,6 +2140,27 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui
spell_target->CalcSpellPowerDistanceMod(spell_id, dist2); spell_target->CalcSpellPowerDistanceMod(spell_id, dist2);
} }
//AE Duration spells were ignoring distance check from item clickies
if(ae_center != nullptr && ae_center != this) {
//casting a spell on somebody but ourself, make sure they are in range
float dist2 = DistanceSquared(m_Position, ae_center->GetPosition());
float range2 = range * range;
float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range;
if(dist2 > range2) {
//target is out of range.
Log(Logs::Detail, Logs::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2);
Message_StringID(13, TARGET_OUT_OF_RANGE);
return(false);
}
else if (dist2 < min_range2){
//target is too close range.
Log(Logs::Detail, Logs::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2);
Message_StringID(13, TARGET_TOO_CLOSE);
return(false);
}
ae_center->CalcSpellPowerDistanceMod(spell_id, dist2);
}
// //
// Switch #2 - execute the spell // Switch #2 - execute the spell