コード例 #1
0
        public void AddScore(Mobile damager, int amount)
        {
            Mobile creditMob = null;

            if (damager is BaseCreature)
            {
                var bc = (BaseCreature)damager;

                if (bc.ControlMaster is PlayerMobile)
                {
                    creditMob = bc.ControlMaster;
                }
                else if (bc.SummonMaster is PlayerMobile)
                {
                    creditMob = bc.SummonMaster;
                }
                else if (bc.BardMaster is PlayerMobile)
                {
                    creditMob = bc.BardMaster;
                }
            }
            else if (damager is PlayerMobile)
            {
                creditMob = damager;
            }

            if (creditMob != null)
            {
                PlayerPortalProfile profile = Portals.EnsureProfile(creditMob as PlayerMobile);
                profile.AddScore(amount, this);
                if (ParticipantsScores.ContainsKey(creditMob as PlayerMobile))
                {
                    ParticipantsScores[creditMob as PlayerMobile] += amount;
                }
                else
                {
                    ParticipantsScores.Add(creditMob as PlayerMobile, amount);
                }
            }
        }
コード例 #2
0
        public void AddScore(Mobile damager, int amount)
        {
            Mobile creditMob = null;

            var oneHandedWeapon = damager.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;
            var twoHandedWeapon = damager.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
            var equipRanged     = twoHandedWeapon as BaseRanged;

            if (damager is BaseCreature)
            {
                var bc = (BaseCreature)damager;

                if (bc.ControlMaster is PlayerMobile)
                {
                    creditMob = bc.ControlMaster;
                    amount    = (int)(Math.Ceiling(amount * EventInvasions.CSOptions.TamerMod));
                }
                else if (bc.SummonMaster is PlayerMobile)
                {
                    creditMob = bc.SummonMaster;
                    amount    = (int)(Math.Ceiling(amount * EventInvasions.CSOptions.SummonMod));
                }
                else if (bc.BardMaster is PlayerMobile)
                {
                    creditMob = bc.BardMaster;
                    amount    = (int)(Math.Ceiling(amount * EventInvasions.CSOptions.BardMod));
                }
            }
            else if (damager is PlayerMobile)
            {
                creditMob = damager;
                if (equipRanged != null)
                {
                    if (twoHandedWeapon.Slayer != SlayerName.None)
                    {
                        amount = (int)(Math.Ceiling(amount * 0.5));
                    }

                    amount = (int)(Math.Ceiling(amount * EventInvasions.CSOptions.ArcherMod));
                }
                else if (oneHandedWeapon != null || twoHandedWeapon != null)
                {
                    if (oneHandedWeapon != null && oneHandedWeapon.Slayer != SlayerName.None ||
                        twoHandedWeapon != null && twoHandedWeapon.Slayer != SlayerName.None)
                    {
                        amount = (int)(Math.Ceiling(amount * 0.5));
                    }

                    amount = (int)(Math.Ceiling(amount * EventInvasions.CSOptions.MeleeMod));
                }
            }

            if (creditMob != null)
            {
                PlayerInvasionProfile profile = EventInvasions.EnsureProfile(creditMob as PlayerMobile);
                profile.AddScore(amount, this);
                if (ParticipantsScores.ContainsKey(creditMob as PlayerMobile))
                {
                    ParticipantsScores[creditMob as PlayerMobile] += amount;
                }
                else
                {
                    ParticipantsScores.Add(creditMob as PlayerMobile, amount);
                }
            }
        }