Beispiel #1
0
        /// <summary>
        /// Calculates chance of spell getting resisted
        /// </summary>
        /// <param name="target">the target of the spell</param>
        /// <returns>chance that spell will be resisted for specific target</returns>
        public override int CalculateSpellResistChance(GameLiving target)
        {
            int             basechance = base.CalculateSpellResistChance(target);
            GameSpellEffect rampage    = SpellHandler.FindEffectOnTarget(target, "Rampage");

            if (rampage != null)
            {
                basechance += (int)rampage.Spell.Value;
            }
            return(Math.Min(100, basechance));
        }
Beispiel #2
0
 /// <summary>
 /// Adds a Spell that will be used by all NPCs of this Entry
 /// </summary>
 public void AddSpells(params uint[] ids)
 {
     foreach (var id in ids)
     {
         var spell = SpellHandler.Get(id);
         if (spell != null)
         {
             AddSpell(spell);
         }
     }
 }
Beispiel #3
0
        public void CastSpell_OnNPCTarget_True()
        {
            var caster       = NewFakePlayer();
            var target       = NewFakeNPC();
            var spell        = NewFakeSpell();
            var spellHandler = new SpellHandler(caster, spell, null);

            bool isCastSpellSuccessful = spellHandler.CastSpell(target);

            Assert.IsTrue(isCastSpellSuccessful);
        }
        public void CheckBeginCast_NPCTarget_True()
        {
            var caster       = NewFakePlayer();
            var spell        = NewFakeSpell();
            var spellHandler = new SpellHandler(caster, spell, null);

            bool isBeginCastSuccessful = spellHandler.CheckBeginCast(NewFakeNPC());

            Console.WriteLine(caster.CurrentRegion.Time);
            Assert.IsTrue(isBeginCastSuccessful);
        }
 public override void Apply()
 {
     if (_ownedPet)
     {
         ((Character)m_cast.CasterObject).IsPetActive = true;
     }
     else
     {
         Summon(SpellHandler.GetSummonEntry(SummonType));
     }
 }
Beispiel #6
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            GameSpellEffect effect2 = SpellHandler.FindEffectOnTarget(target, "Mesmerize");

            if (effect2 != null)
            {
                effect2.Cancel(false);
                return;
            }
            base.ApplyEffectOnTarget(target, effectiveness);
        }
Beispiel #7
0
        public static void Init(TestContext testContext)
        {
            chr                       = Setup.AllianceCharacterPool.Create();
            client                    = chr.FakeClient;
            disenchantSpell           = SpellHandler.Get(SpellId.DisenchantPT);
            disenchantSpell.CastDelay = 0;              // we don't want to wait

            ItemMgr.LoadAll();
            //LootMgr.LoadAll();
            ContentMgr.Load <ItemLootItemEntry>();
        }
Beispiel #8
0
 /// <summary>
 /// Adds a Spell that will be used by all NPCs of this Entry
 /// </summary>
 public void AddSpells(params uint[] ids)
 {
     foreach (uint id in ids)
     {
         Spell spell = SpellHandler.Get(id);
         if (spell != null)
         {
             this.AddSpell(spell);
         }
     }
 }
Beispiel #9
0
 private void Awake()
 {
     if (side.Equals("left"))
     {
         spellHandler = FindObjectOfType <SpellHandlerLeft>();
     }
     else
     {
         spellHandler = FindObjectOfType <SpellHandlerRight>();
     }
 }
Beispiel #10
0
            public static void InitGelihast()
            {
                var net = SpellHandler.Get(SpellId.Net);

                net.AISettings.SetCooldownRange(3000);
                net.MaxTargets = 1;
                net.OverrideAITargetDefinitions(
                    DefaultTargetAdders.AddAreaSource,                                                          // Adder
                    DefaultTargetEvaluators.RandomEvaluator,                                                    // Evaluator
                    DefaultTargetFilters.IsHostile, DefaultTargetFilters.IsPlayer);                             // Filters
            }
Beispiel #11
0
        /// <summary>
        /// Returns the best target to attack
        /// </summary>
        /// <returns>the best target</returns>
        protected override GameLiving CalculateNextAttackTarget()
        {
            if (AggressionState == eAggressionState.Passive)
            {
                return(null);
            }

            if (m_orderAttackTarget != null)
            {
                if (m_orderAttackTarget.IsAlive &&
                    m_orderAttackTarget.ObjectState == GameObject.eObjectState.Active &&
                    GameServer.ServerRules.IsAllowedToAttack(this.Body, m_orderAttackTarget, true))
                {
                    return(m_orderAttackTarget);
                }

                m_orderAttackTarget = null;
            }

            lock ((m_aggroTable as ICollection).SyncRoot)
            {
                IDictionaryEnumerator aggros    = m_aggroTable.GetEnumerator();
                List <GameLiving>     removable = new List <GameLiving>();
                while (aggros.MoveNext())
                {
                    GameLiving living = (GameLiving)aggros.Key;

                    if (living.IsMezzed ||
                        living.IsAlive == false ||
                        living.ObjectState != GameObject.eObjectState.Active ||
                        Body.GetDistanceTo(living, 0) > MAX_AGGRO_LIST_DISTANCE ||
                        GameServer.ServerRules.IsAllowedToAttack(this.Body, living, true) == false)
                    {
                        removable.Add(living);
                    }
                    else
                    {
                        GameSpellEffect root = SpellHandler.FindEffectOnTarget(living, "SpeedDecrease");
                        if (root != null && root.Spell.Value == 99)
                        {
                            removable.Add(living);
                        }
                    }
                }

                foreach (GameLiving living in removable)
                {
                    RemoveFromAggroList(living);
                    Body.RemoveAttacker(living);
                }
            }

            return(base.CalculateNextAttackTarget());
        }
Beispiel #12
0
 /// <summary>
 /// Adds a Spell that will be used by all NPCs of this Entry
 /// </summary>
 public void AddSpells(params SpellId[] ids)
 {
     foreach (SpellId id in ids)
     {
         Spell spell = SpellHandler.Get(id);
         if (spell != null)
         {
             AddSpell(spell);
         }
     }
 }
Beispiel #13
0
 public Aura this[SpellId spellId, bool positive]
 {
     get
     {
         Spell index = SpellHandler.Get(spellId);
         if (index != null)
         {
             return(this[index, positive]);
         }
         return((Aura)null);
     }
 }
Beispiel #14
0
 /// <summary>Returns the first visible Aura with the given SpellId</summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Aura this[SpellId id]
 {
     get
     {
         Spell index = SpellHandler.Get(id);
         if (index != null)
         {
             return(this[index]);
         }
         return((Aura)null);
     }
 }
Beispiel #15
0
 public Aura this[SpellId spellId, bool positive]
 {
     get
     {
         var spell = SpellHandler.Get(spellId);
         if (spell != null)
         {
             return(this[spell, positive]);
         }
         return(null);
     }
 }
Beispiel #16
0
 /// <summary>
 /// Returns the first visible Aura with the given SpellId
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Aura this[SpellId id]
 {
     get
     {
         var spell = SpellHandler.Get(id);
         if (spell != null)
         {
             return(this[spell]);
         }
         return(null);
     }
 }
Beispiel #17
0
        public override void OnAttack(DamageAction action)
        {
            if (action.Spell == null)
            {
                return;
            }
            action.Damage = (int)(action.Damage * 1.0f);
            var spell = SpellHandler.Get(74);//stun 3sec

            action.Victim.Auras.CreateAndStartAura(Owner.SharedReference, spell, false);
            m_aura.Cancel();
        }
        public override void OnAttack(DamageAction action)
        {
            if (action.Spell == null)
            {
                return;
            }
            action.Damage = (int)(action.Damage * 1.5);
            Spell spell = SpellHandler.Get(SpellId.Silence10Rank7FromWindSlasher);

            action.Victim.Auras.CreateAndStartAura(Owner.SharedReference, spell, false, null);
            Aura.Cancel();
        }
        public override void OnAttack(DamageAction action)
        {
            if (action.Spell == null)
            {
                return;
            }
            action.Damage = (int)((double)action.Damage * 1.29999995231628);
            Spell spell = SpellHandler.Get(74U);

            action.Victim.Auras.CreateAndStartAura(this.Owner.SharedReference, spell, false, (Item)null);
            this.m_aura.Cancel();
        }
Beispiel #20
0
        private static void ApplyEquipSpell(Item item, ItemEnchantmentEffect effect)
        {
            var owner = item.OwningCharacter;
            var spell = SpellHandler.Get((SpellId)effect.Misc);

            if (spell == null)
            {
                LogManager.GetCurrentClassLogger().Warn("{0} had invalid SpellId: {1}", effect, (SpellId)effect.Misc);
                return;
            }
            SpellCast.ValidateAndTriggerNew(spell, owner, owner, null, item);
        }
Beispiel #21
0
 public override void OnAttack(DamageAction action)
 {
     if (action.Spell == null)
     {
         return;
     }
     if (Util.Utility.Random(0, 100000) < 2000)
     {
         var spell = SpellHandler.Get(SpellId.Silence10Rank7FromWindSlasher); //silens
         action.Victim.Auras.CreateAndStartAura(Owner.SharedReference, spell, false);
     }
 }
Beispiel #22
0
        public void CalculateToHitChance_BaseChance_Return85()
        {
            var spell        = NewFakeSpell();
            var source       = NewFakePlayer();
            var target       = NewFakePlayer();
            var spellLine    = NewSpellLine();
            var spellHandler = new SpellHandler(source, spell, spellLine);

            int actual = spellHandler.CalculateToHitChance(target);

            Assert.AreEqual(85, actual);
        }
Beispiel #23
0
        internal static void OnLoad()
        {
            if (ObjectManager.Player.ChampionName != "Jayce")
            {
                return;
            }

            Jayce.RootMenu = new Menu("DZJayce", "dz191.jayce", true);
            MenuGenerator.OnLoad(Jayce.RootMenu);
            SpellHandler.OnLoad();
            Jayce.OnLoad();
        }
Beispiel #24
0
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            GameSpellEffect effect;

            effect = SpellHandler.FindEffectOnTarget(target, "Silence");
            if (effect != null)
            {
                MessageToCaster("Your target already have an effect of that type!", eChatType.CT_SpellResisted);
                return;
            }
            base.ApplyEffectOnTarget(target, effectiveness);
        }
Beispiel #25
0
        protected internal override void InitEntry()
        {
            Lock  = LockEntry.Entries.Get((uint)LockId);
            Spell = SpellHandler.Get(SpellId);

            IsConsumable = Fields[5] > 0;

            LinkedTrapId = (uint)Fields[12];

            LosOk        = Fields[16] > 0;
            AllowMounted = Fields[17] > 0;
        }
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            base.OnDirectEffect(target, effectiveness);
            GameSpellEffect effect;

            effect = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
            if (effect != null)
            {
                effect.Cancel(false);
                return;
            }
        }
Beispiel #27
0
        internal static void Init()
        {
            SpellHandler.Init();

            MenuHandler.Init();

            DrawingHandler.Init();

            ModeHandler.Init();

            Chat.Print($"{ChampionName} Loaded!");
        }
Beispiel #28
0
            public override TalentEntry ConvertTo(byte[] rawData, ref int id)
            {
                var talent = new TalentEntry();

                id = (int)(talent.Id = (TalentId)GetUInt32(rawData, 0));

                var treeId = (TalentTreeId)GetUInt32(rawData, 1);

                talent.Tree = TalentTrees.Get((uint)treeId);

                if (talent.Tree == null)
                {
                    return(null);
                }

                talent.Row = GetUInt32(rawData, 2);
                talent.Col = GetUInt32(rawData, 3);

                var  abilities = new List <Spell>(5);
                uint spellId;

                for (int i = 0; i < 9; i++)
                {
                    spellId = GetUInt32(rawData, i + 4);

                    // There are talents linking to invalid spells, eg Dirty Tricks, Rank 3
                    Spell spell;
                    if (spellId == 0 || (spell = SpellHandler.Get(spellId)) == null)
                    {
                        break;
                    }
                    if (spell.IsTeachSpell)
                    {
                        spell = spell.GetEffectsWhere(effect => effect.TriggerSpell != null)[0].TriggerSpell;
                    }

                    if (spell != null)
                    {
                        abilities.Add(spell);
                    }
                    else
                    {
                        log.Warn("Talent has invalid Spell: {0} ({1})", talent.Id, spellId);
                    }
                }
                talent.Spells = abilities.ToArray();

                talent.RequiredId   = (TalentId)GetUInt32(rawData, 13);
                talent.RequiredRank = GetUInt32(rawData, 16);

                return(talent);
            }
Beispiel #29
0
        //public static TextWriter Log = new StreamWriter("GameObjectTypes.txt");

        public static void RalekMain()
        {
            SpellHandler.LoadSpells();

            //ss.FindUsedAuraTypes();
            // SpellStudies.FindAllWithAttribute(SpellAttributes.Flag_8_0x100);
            //ss.FindSpellsWithEffectMasks();
            //ss.DisplayInfo(16205);
            //ss.FindSpellsWithFamilyMask(0x2000, 0, 0);
            //ss.FindSpellsWhere((s) => s.Name.Contains("Mana Spring"), (s)=>"");
            //ss.FindSpellsWithEffect(WCell.Constants.Spells.SpellEffectType.ApplyGlyph);

            /*string exeName = "WoW_3.0.3.9138.exe";
             * using (WoWFile file = new WoWFile(exeName, "3.0.3", "9138"))
             * {
             * string version = string.Format("{0}", file.Version);
             *
             * new UpdateFieldExtractor(file).CreatePacketParserInfo("");
             *
             * SpellFailureExtractor.Extract(file, "SpellFailedReason_3.0.2.9056.cs");
             * UpdateFieldExtractor.DumpEnums(file, "UpdateFields_3.0.3.9138.cs");
             * }*/

            //TextWriter writer = new StreamWriter("DBCcompare.txt");
            //new DBCTools.Compare.DBCDirComparer(@"C:\WoW\Clients\World of Warcraft\Data\enUS\3.0.2.9056\DBFilesClient", @"C:\Dev\WCell\Run\RealmServer\Content\dbc").Compare(writer);
            //string exeName = "WoW_2.3.3.7799.exe";
            //string exeName = "WoW_0.4.0.7897.exe";
            //string exeName = "WoW_2.4.1.8125.exe";
            //string exeName = "WoW_0.0.2.8970.exe";
            //string exeName = "WoW_3.0.2.9056.exe";
            //WoWFile oldfile = new WoWFile("WoW_2.4.3.8606.exe", "2.4.3", "8606");

            /*using (WoWFile file = new WoWFile(exeName,"3.0.2","9056"))
             * {
             * string version = string.Format("{0}", file.Version);
             *
             * new UpdateFieldExtractor(file).CreatePacketParserInfo("");
             * //UpdateFieldWriter.Write(file);
             *
             * //SpellFailureExtractor.Extract(file, "SpellFailedReason_3.0.2.9056.cs");
             * //UpdateFieldExtractor.Extract(file, String.Format("UpdateFields_{0}.cs", version));
             * //UpdateFieldExtractor.Extract(file);
             * //UpdateFieldExtractor.DumpEnums(file, String.Format("UpdateFields_{0}.cs", version));
             * //UpdateFieldComparer.Dump(oldfile, file, "Compare");
             * //SpellFailureExtractor.Extract(file, String.Format("SpellFailedReason_{0}.cs", version));
             * //GameObjectTypeExtractor.Extract(file);
             * }*/

            //Log.Close();

            //Console.ReadLine();
        }
Beispiel #30
0
        private static void ApplyEventNPCData(WorldEvent worldEvent)
        {
            foreach (WorldEventNpcData modelEquip in worldEvent.ModelEquips)
            {
                NPCSpawnEntry spawnEntry = NPCMgr.GetSpawnEntry(modelEquip.Guid);
                if (spawnEntry == null)
                {
                    WorldEventMgr.Log.Warn("Invalid Spawn Entry in World Event NPC Data, Entry: {0}", modelEquip.Guid);
                }
                else
                {
                    if (modelEquip.EntryId != (NPCId)0)
                    {
                        modelEquip.OriginalEntryId = spawnEntry.EntryId;
                        spawnEntry.EntryId         = modelEquip.EntryId;
                        spawnEntry.Entry           = NPCMgr.GetEntry(spawnEntry.EntryId);
                        if (spawnEntry.Entry == null)
                        {
                            WorldEventMgr.Log.Warn("{0} had an invalid World Event EntryId.", (object)spawnEntry);
                            spawnEntry.EntryId = modelEquip.OriginalEntryId;
                            spawnEntry.Entry   = NPCMgr.GetEntry(spawnEntry.EntryId);
                        }
                    }

                    if (modelEquip.ModelId != 0U)
                    {
                        spawnEntry.DisplayIdOverride = modelEquip.ModelId;
                    }
                    if (modelEquip.EquipmentId != 0U)
                    {
                        modelEquip.OriginalEquipmentId = spawnEntry.EquipmentId;
                        spawnEntry.EquipmentId         = modelEquip.EquipmentId;
                        spawnEntry.Equipment           = NPCMgr.GetEquipment(spawnEntry.EquipmentId);
                    }

                    foreach (NPCSpawnPoint npcSpawnPoint in
                             ((IEnumerable <NPCSpawnPoint>)spawnEntry.SpawnPoints.ToArray()).Where <NPCSpawnPoint>(
                                 (Func <NPCSpawnPoint, bool>)(point => point.IsActive)))
                    {
                        npcSpawnPoint.Respawn();
                        if (modelEquip.SpellIdToCastAtStart != SpellId.None)
                        {
                            Spell spell = SpellHandler.Get(modelEquip.SpellIdToCastAtStart);
                            if (spell != null)
                            {
                                int num = (int)npcSpawnPoint.ActiveSpawnling.SpellCast.Start(spell);
                            }
                        }
                    }
                }
            }
        }