Exemplo n.º 1
0
        public static void HandleCastSpellOpcode(ref PacketReader packet, ref WorldManager manager)
        {
            uint spellid = packet.ReadUInt32();

            if (!manager.Character.Spells.ContainsKey(spellid))
            {
                manager.Character.SendCastResult(SpellCheckCastResult.SPELL_FAILED_NOT_KNOWN, spellid);
                return;
            }

            if (!DBC.Spell.ContainsKey(spellid))
            {
                manager.Character.SendCastResult(SpellCheckCastResult.SPELL_FAILED_NOT_KNOWN, spellid);
                return;
            }

            if (manager.Character.Spells[spellid].Cooldown > Globals.TimeTicks)
            {
                manager.Character.SendCastResult(SpellCheckCastResult.SPELL_FAILED_NOT_READY, spellid);
                return;
            }

            SpellTargets targets = new SpellTargets();

            targets.ReadTargets(ref packet, manager.Character);

            SpellCast cast = new SpellCast(manager.Character);

            cast.Targets   = targets;
            cast.Spell     = DBC.Spell[spellid];
            cast.Triggered = false;
            manager.Character.PrepareSpell(cast);
        }
Exemplo n.º 2
0
 public SpellEntry(int spell_idx, SpellClass _spellClass, sbyte _spellLevel,
                   int _fixedRange, int _perLvlRange,
                   int _fixedDuration, byte _perLvlDuration,
                   byte f6, SpellTargets _targets,
                   DamageOnSave _damageOnSave, SaveVerseType _saveVerse,
                   Affects _affectId, SpellWhen _whenCast,
                   int _castingDelay, int _priority, byte fe, byte ff)
 {
     spellClass     = _spellClass;
     spellLevel     = _spellLevel;
     fixedRange     = _fixedRange;
     perLvlRange    = _perLvlRange;
     fixedDuration  = _fixedDuration;
     perLvlDuration = _perLvlDuration;
     field_6        = f6;
     targetType     = _targets;
     damageOnSave   = _damageOnSave;
     saveVerse      = _saveVerse;
     affect_id      = _affectId;
     whenCast       = _whenCast;
     castingDelay   = _castingDelay;
     priority       = _priority;
     field_E        = fe;
     field_F        = ff;
     spellIdx       = spell_idx;
 }
Exemplo n.º 3
0
 // Constructor
 public Spell(int spellId, string spellName, SpellTargets target, byte turns, byte relaunchs, byte targetHp, byte characterHp, SpellResistances resistance,
              byte resistanceValue, byte distanceToClosestMonster, bool handToHand, bool aoe, bool carefulAOE, bool avoidAllies)
 {
     SpellId                  = spellId;
     SpellName                = spellName;
     Target                   = target;
     Turns                    = turns;
     LastTurn                 = 0;
     Relaunchs                = relaunchs;
     RemainingRelaunchs       = Relaunchs;
     TargetHp                 = targetHp;
     CharacterHp              = characterHp;
     Resistance               = resistance;
     ResistanceValue          = resistanceValue;
     DistanceToClosestMonster = distanceToClosestMonster;
     HandToHand               = handToHand;
     AOE         = aoe;
     CarefulAOE  = carefulAOE;
     AvoidAllies = avoidAllies;
 }
Exemplo n.º 4
0
        public SpellCheckCastResult ForceCastSpell(uint spellid, Unit target)
        {
            if (!DBC.Spell.ContainsKey(spellid))
            {
                return(SpellCheckCastResult.SPELL_FAILED_ERROR);
            }

            SpellTargets targets = new SpellTargets
            {
                Target = target
            };

            SpellCast cast = new SpellCast(this)
            {
                Targets   = targets,
                Spell     = DBC.Spell[spellid],
                Triggered = false
            };

            return(this.PrepareSpell(cast));
        }
Exemplo n.º 5
0
        public SpellWhen whenCast; //seg600:37E7 unk_19AF7

        #endregion Fields

        #region Constructors

        public SpellEntry(int spell_idx, SpellClass _spellClass, sbyte _spellLevel,
            int _fixedRange, int _perLvlRange,
            int _fixedDuration, byte _perLvlDuration,
            byte f6, SpellTargets _targets,
            DamageOnSave _damageOnSave, SaveVerseType _saveVerse,
            Affects _affectId, SpellWhen _whenCast,
            int _castingDelay, int _priority, byte fe, byte ff)
        {
            spellClass = _spellClass;
            spellLevel = _spellLevel;
            fixedRange = _fixedRange;
            perLvlRange = _perLvlRange;
            fixedDuration = _fixedDuration;
            perLvlDuration = _perLvlDuration;
            field_6 = f6;
            targetType = _targets;
            damageOnSave = _damageOnSave;
            saveVerse = _saveVerse;
            affect_id = _affectId;
            whenCast = _whenCast;
            castingDelay = _castingDelay;
            priority = _priority;
            field_E = fe;
            field_F = ff;
            spellIdx = spell_idx;
        }