Beispiel #1
0
        public override void InitAbility(Ability Ab)
        {
            this.Ab = Ab;

            if (Ab.Caster.IsUnit())
            {
                Target = Ab.Caster.GetUnit().CbtInterface.GetTarget( GameData.TargetTypes.TARGETTYPES_TARGET_ENEMY );
            }

            if (Ab.Info.Entry == 1667) // Follo me
                CustomValue = GetAbilityDamage();

            if (Ab.Info.Entry == 1682) // Right in da jib
                CustomValue = GetAbilityDamage();

            if (Ab.Info.Entry == 1677) // Savin me hide
                CustomValue = GetAbilityDamage();

            if (Ab.Info.Entry == 1683) // Shut Yer Face
                CustomValue = GetAbilityDamage();

            if (Ab.Info.Entry == 1676) // Skull Thumper
                CustomValue = GetAbilityDamage();

            if (Ab.Info.Entry == 1670) // Trip Em Up
                CustomValue = GetAbilityDamage();

            if (Ab.Info.Entry == 1669) // Trip Em Up
                CustomValue = GetAbilityDamage();

            if (Ab.Info.Entry == 1666) // Wot Armor
                CustomValue = GetAbilityDamage();
        }
Beispiel #2
0
        public int CalculDamage(EquipSlot Slot, Unit Target)
        {
            if (!HasUnit())
                return 0;

            Unit Me = GetUnit();

            if (Me.IsPlayer())
            {
                float Str = GetTotalStat((byte)GameData.Stats.STATS_STRENGTH);
                float Tou = GetTotalStat((byte)GameData.Stats.STATS_TOUGHNESS);
                float Wdps = (float)Me.ItmInterface.GetAttackDamage(Slot) / 10f;
                if (Slot == EquipSlot.MAIN_DROITE)
                    Wdps = (Wdps * 45f) * 0.01f;

                float WSpeed = Me.ItmInterface.GetAttackTime(Slot);
                WSpeed /= 100;

                return (int)(((Str / 10) + Wdps) * WSpeed);
            }
            else if (Me.IsCreature())
            {
                float Damage = (int)(20f + (5f * (float)Me.Level + (float)Me.Rank * 10f));

                if (Me.Level > Target.Level)
                    Damage += ((float)Me.Level - (float)Target.Level) * 8f;
                else if (Target.Level > Me.Level)
                    Damage = Damage - ((float)Target.Level - (float)Me.Level) * 3f;

                return (int)Damage;
            }

            return 1;
        }
Beispiel #3
0
 public Mount(Unit Owner)
 {
     this.Owner = Owner;
     Owner.EvtInterface.AddEventNotify(EventName.ON_RECEIVE_DAMAGE, this.OnTakeDamage);
     Owner.EvtInterface.AddEventNotify(EventName.ON_DEAL_DAMAGE, this.OnDealDamage);
     Owner.EvtInterface.AddEventNotify(EventName.ON_START_CASTING, this.OnStartCast);
 }
Beispiel #4
0
 public Ability(AbilityInterface Interface, Ability Parent, Ability_Stats Info, Unit Caster, bool IsBuff, ushort Px, ushort Py, ushort Pz, ushort ZoneId, string OverrideHandler = "")
     : this(Interface, Parent, Info, Caster, IsBuff, OverrideHandler)
 {
     this.Px = Px;
     this.Py = Py;
     this.Pz = Pz;
     this.ZoneId = ZoneId;
 }
        public override void Start(Ability Ab)
        {
            this.Ab = Ab;

            if (Ab.Caster.IsUnit())
                Target = Ab.Caster.GetUnit().CbtInterface.GetTarget();

            Log.Info("DealDamage", "Target = " + Target);
        }
Beispiel #6
0
        public override void InitAbility(Ability Ab)
        {
            this.Ab = Ab;

            Target = Ab.Caster.CbtInterface.GetTarget(GameData.TargetTypes.TARGETTYPES_TARGET_ALLY);

            if (Target == null)
                Target = Ab.Caster;
        }
        public override void InitAbility(Ability Ab)
        {
            this.Ab = Ab;

            if (Ab.Caster.IsUnit())
            {
                Target = Ab.Caster.GetUnit().CbtInterface.GetTarget(GameData.TargetTypes.TARGETTYPES_TARGET_ENEMY);
            }
        }
        public override void InitAbility(Ability Ab)
        {
            this.Ab = Ab;

            if (Ab.Caster.IsUnit())
            {
                Target = Ab.Caster.GetUnit().CbtInterface.GetTarget(GameData.TargetTypes.TARGETTYPES_TARGET_ALLY);
                /*if (Target != null && !Target.IsPlayer())
                    Target = null;*/
            }
        }
 public override void OnReceiveDamages(Unit Attacker, Ability Spell, ref uint Damages)
 {
     if (IsValid)
     {
         if (CombatInterface.CanAttack(Ab.Caster, Attacker))
         {
             IsValid = false;
             Ab.Caster.DealDamages(Attacker, Ab, GetAbilityDamage());
         }
     }
 }
Beispiel #10
0
        public bool AddRange(Unit Obj)
        {
            if (!HasUnit())
                return false;

            if (CombatInterface.IsEnemy(GetUnit(), Obj))
                RangedEnemies.Add(Obj.GetUnit());
            else
                RangedAllies.Add(Obj.GetUnit());

            return true;
        }
Beispiel #11
0
        public virtual void FollowUnit(Unit Target, int MinDist, int MaxDist,int Speed, eFormationType Form)
        {
            if (Target == null || Target == FollowTarget)
                return;

            StopFollow();

            Target.CbtInterface.AddFollower(Obj.Oid);

            FollowTarget = Target;
            FollowMinDist = MinDist;
            FollowMaxDist = MaxDist;
            Formation = Form;
            FollowSpeed = Speed;
        }
Beispiel #12
0
        public Ability(AbilityInterface Interface, Ability Parent, Ability_Stats Info, Unit Caster, bool IsBuff, string OverrideHandler = "")
        {
            this.Parent = Parent;
            this.Info = Info;
            this.Caster = Caster;
            this.Interface = Interface;
            if (OverrideHandler == "")
                this.Handler = AbilityMgr.GetAbilityHandler(Info.Entry, Info.Info.HandlerName);
            else
                this.Handler = AbilityMgr.GetAbilityHandler(0, OverrideHandler);

            this.IsBuff = IsBuff;

            if (Handler != null)
                Handler.InitAbility(this);
        }
Beispiel #13
0
        public void AddXp(Player Killer, Unit Victim)
        {
            uint activePlayers = 0;

            foreach (Player Plr in Members)
            {
                if (Plr == Killer || Plr.GetDistance(Killer) < 100)
                {
                    activePlayers++;
                }
            }

            foreach (Player Plr in Members)
            {
                if (Plr == Killer || Plr.GetDistance(Killer) < 100)
                {
                    Plr.AddXp(WorldMgr.GenerateXPCount(Plr, Victim) / activePlayers);
                }
            }
        }
        public override void OnReceiveDamages(Unit Attacker, Ability Spell, ref uint Damages)
        {
            if (Damages >= AbsorbCount)
            {
                Damages -= AbsorbCount;
                AbsorbCount = 0;
                //Attacker.SendCastEffect(Ab.Caster, (ushort)(Spell != null ? Spell.Info.Entry : 0), GameData.CombatEvent.COMBATEVENT_ABSORB, 100);

                /*PacketOut Out = new PacketOut((byte)Opcodes.F_HIT_PLAYER);
                Out.WriteUInt16(Attacker.Oid);
                Out.WriteUInt16(Ab.Caster.Oid);
                Out.WriteHexStringBytes("000008C21D000000");
                Ab.Caster.GetPlayer().SendPacket(Out);*/
            }
            else
            {
                AbsorbCount -= Damages;
                Damages = 0;
                //Attacker.SendCastEffect(Ab.Caster, (ushort)(Spell != null ? Spell.Info.Entry : 0), GameData.CombatEvent.COMBATEVENT_ABSORB, 100);
            }
        }
Beispiel #15
0
        public void OnTargetDie(Unit Victim)
        {
            RemoveAggro(Victim.Oid);

            if (GetAggroCount() <= 0)
                CombatStop();

            Obj.EvtInterface.Notify("OnTargetDie", Victim, null);
        }
Beispiel #16
0
        public void OnTakeDamage(Unit Fighter, UInt32 DamageCount)
        {
            switch (State)
            {
                case AiState.STANDING:
                    CombatStart(Fighter);
                    break;
            };

            AddDamageReceive(Fighter.Oid, DamageCount);
            Obj.EvtInterface.Notify("OnTakeDamage", Fighter, null);
        }
Beispiel #17
0
 public void OnDealDamage(Unit Victim, UInt32 DamageCount)
 {
     switch (State)
     {
         case AiState.STANDING:
             CombatStart(Victim);
             break;
     };
     Obj.EvtInterface.Notify("OnDealDamage", Victim, null);
 }
Beispiel #18
0
        public void LookAt(Unit Target)
        {
            if (HasPlayer())
                return;

            if (!Obj.IsCreature())
                return;

            if (CheckSpawnRange())
                return;

            Creature Crea = Obj.GetCreature();
            Crea.MvtInterface.FollowUnit(Target, 7, 10,200, eFormationType.Protect);
        }
Beispiel #19
0
        public bool IsFightingWithFriend(Unit Me)
        {
            if (!HasTarget())
                return false;

            if (!IsFighting())
                return false;

            if(IsFriend(Me, CurrentTarget.Target))
                return true;
            else
                return false;
        }
Beispiel #20
0
 public void CombatStart(Unit Fighter)
 {
     Log.Success("CombatStart", Obj.Name + " Start combat with " + Fighter.Name);
     State = AiState.FIGHTING;
     GetAggro(Fighter.Oid).DamagesReceive+=100;
 }
Beispiel #21
0
        public void AttackAI(Unit Target)
        {
            if (Target == null)
            {
                if (State == AiState.FIGHTING)
                    CombatStop();

                return;
            }

            long Tick = TCPManager.GetTimeStampMS();

            SetTarget(Target);
            LookAt(Target);

            if (NextAttackTime < Tick)
            {
                if (Obj.IsWithinRadius(Target, 10))
                {
                    Obj.GetUnit().Strike(Target);
                    NextAttackTime = Tick + 2000;
                }
            }
        }
Beispiel #22
0
 public static bool IsFriend(Unit A, Unit B)
 {
     return A.Realm == B.Realm;
 }
Beispiel #23
0
        public static bool IsEnemy(Unit A, Unit B)
        {
            if (A.Realm == GameData.Realms.REALMS_REALM_NEUTRAL && B.Realm == GameData.Realms.REALMS_REALM_NEUTRAL)
                return false;

            return A.Realm != B.Realm;
        }
Beispiel #24
0
        public static GameData.TargetTypes GetTargetType(Unit A, Unit B)
        {
            if (B == null)
                return GameData.TargetTypes.TARGETTYPES_TARGET_NONE;

            if (A == B)
                return GameData.TargetTypes.TARGETTYPES_TARGET_SELF;

            if (IsEnemy(A, B))
                return GameData.TargetTypes.TARGETTYPES_TARGET_ENEMY;

            if (IsFriend(A, B))
                return GameData.TargetTypes.TARGETTYPES_TARGET_ALLY;

            return GameData.TargetTypes.TARGETTYPES_TARGET_NONE;
        }
Beispiel #25
0
        public static Loot GenerateLoot(Unit Corps, Unit Looter)
        {
            if (!Looter.IsPlayer())
                return null;

            if (Corps.IsCreature())
            {
                Creature Crea = Corps.GetCreature();

                List<Creature_loot> CreatureLoots = WorldMgr.GetLoots(Crea.Entry);
                if (CreatureLoots.Count <= 0)
                    return null;

                List<LootInfo> Loots = new List<LootInfo>();
                foreach (Creature_loot Loot in CreatureLoots)
                {
                    float Pct = Loot.Pct * Program.Config.GlobalLootRate;
                    if (Pct <= 0)
                        Pct = 0.01f;

                    switch ((SystemData.ItemRarity)Loot.Info.Rarity)
                    {
                        case SystemData.ItemRarity.ITEMRARITY_COMMON:
                            Pct *= Program.Config.CommonLootRate;
                            break;
                        case SystemData.ItemRarity.ITEMRARITY_UNCOMMON:
                            Pct *= Program.Config.UncommonLootRate;
                            break;
                        case SystemData.ItemRarity.ITEMRARITY_RARE:
                            Pct *= Program.Config.RareLootRate;
                            break;
                        case SystemData.ItemRarity.ITEMRARITY_VERY_RARE:
                            Pct *= Program.Config.VeryRareLootRate;
                            break;
                        case SystemData.ItemRarity.ITEMRARITY_ARTIFACT:
                            Pct *= Program.Config.ArtifactLootRate;
                            break;
                    };

                    // Je Fawk | 14 April 2014 | Declined fix
                    #region <Commented>
                    // Fixing the drop rate so that a mob can drop the same item type more than once based on drop % Pct
                    // If the drop percentage is lower than 100%
                    //if (Pct < 100.0f)
                    //{
                    //    if (RandomMgr.Next(10000) <= (Pct*100))
                    //    {
                    //        Loots.Add(new LootInfo(Loot.Info));
                    //    }
                    //}
                    //else
                    //    // If the drop percentage is between 100% and 999%
                    //    if ((Pct > 100.0f) && (Pct < 1000.0f))
                    //    {
                    //        // For each 100 percentage give the player 1 item
                    //        for (byte i = 0; i < Math.Floor((Pct / 100.0f)); i++)
                    //        {
                    //            Loots.Add(new LootInfo(Loot.Info));
                    //        }
                    //        // For the rest that's below 100 do a roll for a new item
                    //        if (RandomMgr.Next(10000) <= ((Pct % 100) * 100))
                    //        {
                    //            Loots.Add(new LootInfo(Loot.Info));
                    //        }
                    //    }
                    //    else
                    //        // For the extreme case where we want the item to drop more than 10 per mob
                    //        if (( Pct > 1000.0f) && (Pct < 10000.0f))
                    //        {
                    //            // For each 100 percentage give the player 1 item
                    //            for (int i = 0; i < Math.Floor((Pct / 100.0f)); i++)
                    //            {
                    //                Loots.Add(new LootInfo(Loot.Info));
                    //            }
                    //            // For the rest that's below 100 do a roll for a new item
                    //            if (RandomMgr.Next(10000) <= ((Pct % 1000) * 100))
                    //            {
                    //                Loots.Add(new LootInfo(Loot.Info));
                    //            }
                    //        }
                    #endregion

                    if (Pct > 100.0f || RandomMgr.Next(10000) < (Pct * 100))
                        Loots.Add(new LootInfo(Loot.Info));
                }

                UInt32 Money = (UInt32)(Corps.Level * (UInt32)7) + (Corps.Rank * (UInt32)50);

                if (Loots.Count > 0 || Money > 0)
                {
                    Log.Success("LootMgr", "Generate Loot : " + Loots.Count);
                    Loot Lt = new Loot();
                    Lt.Money = Money;
                    Lt.Loots = Loots.ToArray();
                    return Lt;
                }

            }

            return null;
        }
Beispiel #26
0
 public void SetTarget(Unit Target)
 {
     CurrentTarget.Target = Target;
     CurrentTarget.Type = GetTargetType(GetUnit(), Target);
 }
Beispiel #27
0
 public TargetInfo(Unit Target, GameData.TargetTypes Type)
 {
     this.Target = Target;
     this.Type = Type;
 }
Beispiel #28
0
        /* // Group LOOT : Pass , accept, cancel
         * Out.WritePacketString(@"|07 19 0A 00 00 00 00 03 2E 56 22 B9 00 |............V..|
|00 00 00 00 00 00 00 00 24 00 00 00 00 00 01 00 |........$.......|
|00 00 00 00 00 00 00 00 00 00 00 00 00 09 C4 00 |................|
|01 00 00 00 00 00 00 00 00 00 00 00 00 09 57 61 |..............Wa|
|72 20 43 72 65 73 74 00 00 00 00 00 00 71 50 72 |r Crest......qPr|
|6F 6F 66 20 6F 66 20 79 6F 75 72 20 76 61 6C 6F |oof of your valo|
|72 20 6F 6E 20 74 68 65 20 66 69 65 6C 64 20 6F |r on the field o|
|66 20 62 61 74 74 6C 65 2E 20 54 68 65 73 65 20 |f battle. These |
|6D 61 79 20 62 65 20 75 73 65 64 20 74 6F 20 74 |may be used to t|
|72 61 64 65 20 66 6F 72 20 65 71 75 69 70 6D 65 |rade for equipme|
|6E 74 20 66 72 6F 6D 20 76 61 72 69 6F 75 73 20 |nt from various |
|51 75 61 72 74 65 72 6D 61 73 74 65 72 73 2E 01 |Quartermasters..|
|00 00 00 03 06 00 08 00 00 00 00 00 00 00 00 00 |................|
|00 00 00 00 00 00 00 00 00 00                   |..........      |");*/

        public override void SetDeath(Unit Killer)
        {
            Killer.QtsInterface.HandleEvent(Objective_Type.QUEST_KILL_MOB, Spawn.Entry,1);
            base.SetDeath(Killer);
            EvtInterface.AddEvent(RezUnit, 30000 + Level * 1000, 1); // 30 seconde Rez
        }
Beispiel #29
0
        public static void GenerateXP(Unit Killer, Unit Victim)
        {
            UInt32 KLvl = Killer.Level;
            UInt32 VLvl = Victim.Level;

            if (KLvl > VLvl + 8)
                return;

            UInt32 XP = VLvl * 60;
            XP += (UInt32)Victim.Rank * 20;

            if (KLvl > VLvl)
                XP -= (UInt32)(((float)XP / (float)100) * (KLvl - VLvl + 1)) * 5;

            if (Program.Config.XpRate > 0)
                XP *= (UInt32)Program.Config.XpRate;

            if (Killer.IsPlayer())
                Killer.GetPlayer().AddXp(XP);
        }
Beispiel #30
0
        public static bool CanAttack(Unit A, Unit B)
        {
            if (A.IsDead || B.IsDead)
                return false;

            if (A == B)
                return false;

            if (!IsEnemy(A, B))
                return false;

            if (!A.IsInWorld() || !B.IsInWorld())
                return false;

            return true;
        }