Beispiel #1
0
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);

            if (Utility.RandomDouble() <= CrudeBoneArmorDropChance)
            {
                if (Utility.RandomDouble() <= .4)
                {
                    BaseWeapon weapon = UOACZSystem.GetRandomCrudeBoneWeapon();

                    if (weapon != null)
                    {
                        c.AddItem(weapon);
                    }
                }

                else
                {
                    BaseArmor armor = UOACZSystem.GetRandomCrudeBoneArmor();

                    if (armor != null)
                    {
                        c.AddItem(armor);
                    }
                }
            }
        }
Beispiel #2
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            PlayerMobile player = from as PlayerMobile;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }
            if (!player.IsUOACZHuman)
            {
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            if (!from.CanBeginAction(typeof(UOACZOilFlask)))
            {
                from.SendMessage("You must wait a few moments before using another oil flask.");
                return;
            }

            player.SendMessage("Target a location to create an oil surface at.");
            player.Target = new OilFlaskTarget(this);
        }
Beispiel #3
0
        public override void OnSingleClick(Mobile from)
        {
            LabelTo(from, Name);

            if (from.AccessLevel > AccessLevel.Player)
            {
                LabelTo(from, "(" + YieldsRemaining.ToString() + " items remaining)");
            }

            PlayerMobile player = from as PlayerMobile;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }

            int interactionCount = GetInteractions(player);

            if (from.AccessLevel == AccessLevel.Player)
            {
                if (YieldsRemaining == 0 || interactionCount >= MaxPlayerInteractions)
                {
                    LabelTo(from, NoYieldRemainingSingleClickText);
                }
            }

            if (Locked)
            {
                LabelTo(from, LockedSingleClickText);
            }
        }
        public override bool OnBeforeDeath()
        {
            foreach (Mobile mobile in m_EngulfedMobiles)
            {
                if (mobile == null)
                {
                    continue;
                }
                if (mobile.Deleted)
                {
                    continue;
                }

                mobile.Squelched = false;
                mobile.Hidden    = false;

                if (!UOACZSystem.IsUOACZValidMobile(mobile))
                {
                    continue;
                }

                TimedStatic ichor = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5);
                ichor.Hue  = 2051;
                ichor.Name = "ichor";
                ichor.MoveToWorld(mobile.Location, mobile.Map);

                Effects.PlaySound(mobile.Location, mobile.Map, Utility.RandomList(0x101));
            }

            return(base.OnBeforeDeath());
        }
Beispiel #5
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }
            if (!player.IsUOACZHuman)
            {
                return;
            }

            Item item = from.FindItemOnLayer(Server.Layer.TwoHanded);

            if (item != this)
            {
                from.SendMessage("You must equip this fishing pole in order to use it.");
                return;
            }

            if (!player.CanBeginAction(typeof(UOACZBaseScavengeObject)))
            {
                player.SendMessage("You must wait a moment before using that.");
                return;
            }

            from.SendMessage("Target the fishing location to fish from.");
            from.Target = new UOACZFishingTarget(this);
        }
Beispiel #6
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }
            if (!player.IsUOACZHuman)
            {
                return;
            }

            Item oneHand    = from.FindItemOnLayer(Layer.OneHanded);
            Item firstValid = from.FindItemOnLayer(Layer.FirstValid);

            if (!(oneHand == this || firstValid == this))
            {
                from.SendMessage("You must equip this pickaxe in order to use it.");
                return;
            }

            if (!player.CanBeginAction(typeof(UOACZBaseScavengeObject)))
            {
                player.SendMessage("You must wait a moment before using that.");
                return;
            }

            from.SendMessage("Target the rock formation to mine.");
            from.Target = new UOACZMiningTarget(this);
        }
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            if (m_Player != null)
            {
                if (m_Player != player)
                {
                    from.SendMessage("That item may only be used by " + m_Player.Name + ".");
                    return;
                }
            }

            UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadUpgradePoints, 1, true);
            player.SendSound(UOACZSystem.earnCorruptionSound);

            UOACZSystem.RefreshAllGumps(player);

            Delete();
        }
Beispiel #8
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }

            if (player.IsUOACZUndead)
            {
                return;
            }

            if (player.IsUOACZHuman)
            {
                if (!from.InRange(GetWorldLocation(), InteractionRange))
                {
                    from.SendMessage("That is too far away.");
                    return;
                }

                base.OnDoubleClick(from);

                return;
            }
        }
Beispiel #9
0
        public override void OnSingleClick(Mobile from)
        {
            LabelTo(from, DisplayName + " Stockpile");
            LabelTo(from, "[Durability: " + HitPoints.ToString() + "/" + MaxHitPoints.ToString() + "]");

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }
            if (!player.IsUOACZHuman)
            {
                return;
            }
            if (player.m_UOACZAccountEntry.HumanProfile.Stockpile == null)
            {
                return;
            }

            LabelTo(from, "Your Items: " + player.m_UOACZAccountEntry.HumanProfile.Stockpile.TotalItems.ToString() + " / " + player.m_UOACZAccountEntry.HumanProfile.Stockpile.MaxItems.ToString() + "");
        }
Beispiel #10
0
        public virtual bool CanInteract(PlayerMobile player)
        {
            bool canInteract = true;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return(false);
            }

            return(canInteract);
        }
Beispiel #11
0
        public override void DoAction(PlayerMobile player)
        {
            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }

            player.Animate(32, 5, 1, true, false, 0);
            player.RevealingAction();

            Effects.PlaySound(player.Location, player.Map, 0x3E3);
        }
Beispiel #12
0
        public override void DoAction(PlayerMobile player)
        {
            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }

            player.Animate(12, 7, 1, true, false, 0);
            player.PlaySound(Utility.RandomList(0x125, 0x126));

            player.RevealingAction();
        }
Beispiel #13
0
            protected override void OnTarget(Mobile from, object target)
            {
                PlayerMobile player = from as PlayerMobile;

                if (!UOACZSystem.IsUOACZValidMobile(player))
                {
                    return;
                }
                if (!player.IsUOACZHuman)
                {
                    return;
                }
                if (m_ConstructionDeed == null)
                {
                    return;
                }
                if (m_ConstructionDeed.Deleted)
                {
                    return;
                }

                if (!m_ConstructionDeed.IsChildOf(from.Backpack))
                {
                    player.SendMessage("That item must be in your pack in order to use it.");
                    return;
                }

                if (target is UOACZConstructionTile)
                {
                    UOACZConstructionTile constructionTile = target as UOACZConstructionTile;

                    if (Utility.GetDistance(player.Location, constructionTile.Location) > 1 || (Math.Abs(player.Location.Z - constructionTile.Location.Z) > 20))
                    {
                        player.SendMessage("You are too far away from that construction location.");
                        return;
                    }

                    if (constructionTile.Constructable != null)
                    {
                        player.SendMessage("That construction location already has something under construction.");
                        return;
                    }

                    constructionTile.PlaceObject(player, m_ConstructionDeed);
                }

                else
                {
                    player.SendMessage("That is not a valid construction location.");
                    return;
                }
            }
Beispiel #14
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            PlayerMobile player = from as PlayerMobile;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }
            if (!player.IsUOACZHuman)
            {
                return;
            }

            if (!IsChildOf(player.Backpack))
            {
                player.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            if (!player.CanBeginAction(typeof(UOACZRepairHammer)))
            {
                player.SendMessage("You are already using a repair hammer.");
                return;
            }

            if (m_Owner != null && m_Owner != player)
            {
                player.SendMessage("Someone else is using that repair hammer.");
                return;
            }

            if (!player.CanBeginAction(typeof(BreakableStatic)))
            {
                player.SendMessage("You must wait a few moments before attempting another action.");
                return;
            }

            if (GetNearbyBreakableStatics(player).Count == 0)
            {
                player.SendMessage("There are no nearby objects in need of repairs.");
                return;
            }

            m_Timer = null;
            m_Timer = new InternalTimer(this, player);
            m_Timer.Start();

            player.SendMessage("You begin making repairs.");
        }
Beispiel #15
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }

            if (player.IsUOACZUndead)
            {
                base.OnDoubleClick(player);

                return;
            }

            else if (player.IsUOACZHuman)
            {
                if (!from.InRange(GetWorldLocation(), InteractionRange))
                {
                    from.SendMessage("That is too far away.");
                    return;
                }

                bool needStockpile = false;

                if (player.m_UOACZAccountEntry.HumanProfile.Stockpile == null)
                {
                    needStockpile = true;
                }

                if (player.m_UOACZAccountEntry.HumanProfile.Deleted == null)
                {
                    needStockpile = true;
                }

                if (needStockpile)
                {
                    player.m_UOACZAccountEntry.HumanProfile.Stockpile = new UOACZStockpileContainer(player.m_UOACZAccountEntry.m_AccountUsername);
                }

                player.m_UOACZAccountEntry.HumanProfile.Stockpile.AccountEntry = player.m_UOACZAccountEntry;

                Point3D newLocation = new Point3D(Location.X, Location.Y, Location.Z);
                player.m_UOACZAccountEntry.HumanProfile.Stockpile.MoveToWorld(newLocation, from.Map);
                player.m_UOACZAccountEntry.HumanProfile.Stockpile.Z -= 1;

                player.m_UOACZAccountEntry.HumanProfile.Stockpile.Open(from);
            }
        }
Beispiel #16
0
        public override bool CanInteract(PlayerMobile player)
        {
            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return(false);
            }
            if (!player.IsUOACZHuman)
            {
                return(false);
            }

            Item oneHand    = player.FindItemOnLayer(Layer.OneHanded);
            Item firstValid = player.FindItemOnLayer(Layer.FirstValid);

            if (!(oneHand is UOACZPickaxe || firstValid is UOACZPickaxe))
            {
                player.SendMessage("You must equip this pickaxe in order to use it.");
                return(false);
            }

            UOACZPickaxe pickaxe = null;

            if (oneHand is UOACZPickaxe)
            {
                pickaxe = oneHand as UOACZPickaxe;
            }

            if (firstValid is UOACZPickaxe)
            {
                pickaxe = firstValid as UOACZPickaxe;
            }

            if (pickaxe == null)
            {
                return(false);
            }

            if (pickaxe.UsesRemaining > 1)
            {
                pickaxe.UsesRemaining--;
            }

            else
            {
                pickaxe.Delete();
            }

            return(base.CanInteract(player));
        }
Beispiel #17
0
        public override void OnMiss(Mobile attacker, Mobile defender)
        {
            double arrowChance = 0.4;

            if (UOACZSystem.IsUOACZValidMobile(attacker))
            {
                arrowChance = .66;
            }

            if (attacker.Player && arrowChance >= Utility.RandomDouble() && !DuelContext.IsFreeConsume(attacker))
            {
                Ammo.MoveToWorld(new Point3D(defender.X + Utility.RandomMinMax(-1, 1), defender.Y + Utility.RandomMinMax(-1, 1), defender.Z), defender.Map);
            }

            base.OnMiss(attacker, defender);
        }
Beispiel #18
0
        public override bool OnMoveOver(Mobile mobile)
        {
            if (!UOACZSystem.IsUOACZValidMobile(mobile))
            {
                return(true);
            }

            mobile.FixedParticles(0x374A, 10, 20, 5021, 0x110, 0, EffectLayer.Head);
            mobile.PlaySound(m_HitSound);

            Poison poison = Poison.GetPoison(Utility.RandomMinMax(0, 1));

            mobile.ApplyPoison(m_Owner, poison);

            return(true);
        }
        public bool CanRepair(Mobile from, Item item, double value, bool message)
        {
            bool canRepair = true;

            PlayerMobile player = from as PlayerMobile;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return(false);
            }
            if (!player.IsUOACZHuman)
            {
                return(false);
            }

            if (!AllowRepair)
            {
                if (message)
                {
                    player.SendMessage("That is not repairable.");
                }

                return(false);
            }

            if (!player.InRange(GetWorldLocation(), InteractionRange))
            {
                if (message)
                {
                    player.SendMessage("That is too far away.");
                }

                return(false);
            }

            if (HitPoints == MaxHitPoints)
            {
                if (message)
                {
                    player.SendMessage("That is not damaged.");
                }

                return(false);
            }

            return(canRepair);
        }
        protected override bool OnMove(Direction d)
        {
            foreach (Mobile mobile in m_EngulfedMobiles)
            {
                if (mobile == null)
                {
                    continue;
                }
                if (mobile.Deleted)
                {
                    continue;
                }
                if (!UOACZSystem.IsUOACZValidMobile(mobile))
                {
                    continue;
                }
                if (Utility.GetDistance(mobile.Location, Location) >= 12)
                {
                    continue;
                }

                PlayerMobile player = mobile as PlayerMobile;

                if (player != null)
                {
                    if (!player.IsUOACZHuman)
                    {
                        continue;
                    }
                }

                mobile.Location = Location;
            }

            if (Utility.RandomDouble() <= .33)
            {
                TimedStatic ichor = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5);
                ichor.Hue  = 2051;
                ichor.Name = "ichor";
                ichor.MoveToWorld(Location, Map);

                Effects.PlaySound(Location, Map, Utility.RandomList(0x101));
            }

            return(base.OnMove(d));
        }
        public override void ResolveTrap(Mobile from)
        {
            PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, ScavengeUndeadTrapText);

            int creatures = (int)(Math.Ceiling((double)TrapDifficulty / 50));

            for (int a = 0; a < creatures; a++)
            {
                Point3D spawnLocation = new Point3D(Location.X + Utility.RandomList(-1, 1), Location.Y + Utility.RandomList(-1, 1), Location.Z);
                SpellHelper.AdjustField(ref spawnLocation, Map, 12, false);

                int             threatLevel = UOACZPersistance.m_ThreatLevel - 30;
                UOACZBaseUndead bc_Creature = (UOACZBaseUndead)Activator.CreateInstance(UOACZBaseUndead.GetRandomUndeadType(0, threatLevel));

                if (bc_Creature != null)
                {
                    if (Map.CanSpawnMobile(spawnLocation))
                    {
                        bc_Creature.MoveToWorld(spawnLocation, Map);
                    }

                    else
                    {
                        if (UOACZSystem.IsUOACZValidMobile(from))
                        {
                            spawnLocation = new Point3D(from.Location.X + Utility.RandomList(-1, 1), from.Location.Y + Utility.RandomList(-1, 1), from.Location.Z);
                            SpellHelper.AdjustField(ref spawnLocation, Map, 12, false);

                            if (Map.CanSpawnMobile(spawnLocation))
                            {
                                bc_Creature.MoveToWorld(spawnLocation, Map);
                            }

                            else
                            {
                                bc_Creature.MoveToWorld(from.Location, Map);
                            }
                        }
                    }
                }
            }

            TrapType = ScavengeTrapType.None;
        }
Beispiel #22
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            if (!UOACZPersistance.Enabled)
            {
                from.SendMessage("UOACZ system currently disabled.");
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            if (m_Player != null)
            {
                Account ownerAccount  = m_Player.Account as Account;
                Account playerAccount = player.Account as Account;

                if (ownerAccount != null && playerAccount != null && ownerAccount != playerAccount)
                {
                    from.SendMessage("That item may only be used by " + m_Player.Name + ".");
                    return;
                }
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.SurvivalPoints, 1, true);
            player.SendSound(UOACZSystem.earnSurvivalSound);

            UOACZSystem.RefreshAllGumps(player);

            Delete();
        }
Beispiel #23
0
        public void CheckScore(PlayerMobile player, int amount)
        {
            if (player == null || amount == 0)
            {
                return;
            }

            int score     = (int)(Math.Floor((double)amount / (double)UOACZSystem.HumanBonesPerScore));
            int remainder = amount % UOACZSystem.HumanBonesPerScore;

            if (Utility.RandomDouble() <= ((double)remainder / (double)UOACZSystem.HumanBonesPerScore))
            {
                score++;
            }

            if (score > 0)
            {
                UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.HumanScore, score, true);
            }
        }
Beispiel #24
0
        public override void OnHit(Mobile attacker, Mobile defender, double damageBonus)
        {
            double arrowChance = 0.4;

            if (UOACZSystem.IsUOACZValidMobile(attacker))
            {
                arrowChance = .66;
            }

            if (attacker.Player && !defender.Player && (defender.Body.IsAnimal || defender.Body.IsMonster) && arrowChance >= Utility.RandomDouble())
            {
                defender.AddToBackpack(Ammo);
            }

            base.OnHit(attacker, defender, damageBonus);

            if (!(attacker is PlayerMobile && defender is PlayerMobile))
            {
                AttemptWeaponPoison(attacker, defender);
            }
        }
Beispiel #25
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }
            if (!player.IsUOACZHuman)
            {
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            player.SendMessage("Target the construction site for this item.");
            player.Target = new ConstructionTileTarget(this);
        }
Beispiel #26
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }
            if (!player.IsUOACZHuman)
            {
                return;
            }

            if (!player.CanBeginAction(typeof(UOACZTorch)))
            {
                player.SendMessage("You may only use a torch once every " + CooldownSeconds.ToString() + " seconds.");
                return;
            }

            player.SendMessage("Target a creature or location to throw the torch at.");
            player.Target = new TorchThrowTarget(this);
        }
Beispiel #27
0
        public static void EventSink_AggressiveAction(AggressiveActionEventArgs e)
        {
            PlayerMobile pm_From   = e.Aggressor as PlayerMobile;
            PlayerMobile pm_Target = e.Aggressed as PlayerMobile;

            BaseCreature bc_Target = e.Aggressed as BaseCreature;

            //UOACZ
            if (pm_From != null && bc_Target != null)
            {
                if (pm_From.IsUOACZHuman && bc_Target is UOACZBaseHuman)
                {
                    if (!CheckAggressions(pm_From, bc_Target) && pm_From.AccessLevel == AccessLevel.Player)
                    {
                        UOACZSystem.ChangeStat(pm_From, UOACZSystem.UOACZStatType.Honor, UOACZSystem.HumanAttackCivilianHonorLoss, true);
                    }
                }
            }

            if (pm_From == null || pm_Target == null)
            {
                return;
            }

            if (!CheckAggressions(pm_From, pm_Target) && pm_From.AccessLevel == AccessLevel.Player)
            {
                pm_From.LocalOverheadMessage(MessageType.Regular, Hue, true, String.Format(AggressorFormat, pm_Target.Name));
                pm_Target.LocalOverheadMessage(MessageType.Regular, Hue, true, String.Format(AggressedFormat, pm_From.Name));

                //UOACZ
                if (pm_From.IsUOACZHuman && pm_Target.IsUOACZHuman)
                {
                    if (Notoriety.Compute(pm_From, pm_Target) == Notoriety.Innocent)
                    {
                        UOACZSystem.ChangeStat(pm_From, UOACZSystem.UOACZStatType.Honor, UOACZSystem.HumanAttackPlayerHonorLoss, true);
                    }
                }
            }
        }
        public override void DoAction(PlayerMobile player)
        {
            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }

            player.Animate(11, 5, 1, true, false, 0);
            player.RevealingAction();

            Point3D location = Location;
            Map     map      = Map;

            Effects.PlaySound(player.Location, player.Map, 0x33C);

            IEntity startLocation = new Entity(Serial.Zero, new Point3D(player.X, player.Y, player.Z + 10), player.Map);
            IEntity endLocation   = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z), map);

            Effects.SendMovingEffect(startLocation, endLocation, 574, 5, 0, false, false, 0, 0);

            double distance         = Utility.GetDistanceToSqrt(startLocation.Location, endLocation.Location);
            double destinationDelay = (double)distance * .12;

            Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
            {
                if (!UOACZPersistance.Active)
                {
                    return;
                }

                Effects.SendLocationEffect(location, map, 0x352D, 16, 4);
                Effects.PlaySound(location, map, 0x364);

                TimedStatic bobber = new TimedStatic(574, ScavengeDuration.TotalSeconds - .5);
                bobber.Name        = "fishing bobber";
                bobber.MoveToWorld(location, map);
            });
        }
Beispiel #29
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }
            if (!player.IsUOACZHuman)
            {
                return;
            }

            if (DamageState == DamageStateType.Broken || DamageState == DamageStateType.HeavilyDamaged)
            {
                player.SendMessage("This must be repaired before it may be used.");
                return;
            }

            if (m_NextTimeUsable > DateTime.UtcNow)
            {
                string cooldownRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, m_NextTimeUsable, false, true, true, true, true);
                player.SendMessage("You must wait " + cooldownRemaining + " before that may be used again.");

                return;
            }

            if (Utility.GetDistance(player.Location, Location) > 1 || (Math.Abs(player.Location.Z - Location.Z) > 20))
            {
                player.SendMessage("You are too far away from that to use it.");
                return;
            }

            player.SendMessage("Target the location you wish to pour the cauldron onto.");
            player.Target = new CauldronTarget(this);
        }
Beispiel #30
0
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);

            Dictionary <PlayerMobile, int> m_PlayerDamageDealt = new Dictionary <PlayerMobile, int>();
            List <PlayerMobile>            m_PotentialPlayers  = new List <PlayerMobile>();

            int scoreValue = 1;

            double rewardChance          = 0.0;
            double corruptionStoneChance = 0.0;
            double upgradeTokenChance    = 0.0;

            #region Upgrade Chances

            switch (DifficultyValue)
            {
            //Civilian
            case 1:
                scoreValue = 1;

                rewardChance          = .8;
                corruptionStoneChance = .6;
                upgradeTokenChance    = .4;
                break;

            case 2:
                scoreValue = 2;

                rewardChance          = .8;
                corruptionStoneChance = .6;
                upgradeTokenChance    = .4;
                break;

            //Militia
            case 3:
                scoreValue = 3;

                rewardChance          = 1.0;
                corruptionStoneChance = .8;
                upgradeTokenChance    = .6;
                break;

            case 4:
                scoreValue = 4;

                rewardChance          = 1.0;
                corruptionStoneChance = .8;
                upgradeTokenChance    = .6;
                break;

            //Elite
            case 5:
                scoreValue = 5;

                rewardChance          = 1.2;
                corruptionStoneChance = 1.0;
                upgradeTokenChance    = .8;
                break;

            case 6:
                scoreValue = 6;

                rewardChance          = 1.2;
                corruptionStoneChance = 1.0;
                upgradeTokenChance    = .8;
                break;

            //Sentry
            case 7:
                scoreValue = 7;

                rewardChance          = 1.4;
                corruptionStoneChance = 1.2;
                upgradeTokenChance    = 1.0;
                break;

            case 8:
                scoreValue = 8;

                rewardChance          = 1.4;
                corruptionStoneChance = 1.2;
                upgradeTokenChance    = 1.0;
                break;

            //Unique
            case 9:
                scoreValue = 9;

                rewardChance          = 2;
                corruptionStoneChance = 2;
                upgradeTokenChance    = 2;
                break;

            case 10:
                scoreValue = 40;

                rewardChance          = 2;
                corruptionStoneChance = 2;
                upgradeTokenChance    = 2;
                break;

            case 11:
                scoreValue = 80;

                rewardChance          = 2;
                corruptionStoneChance = 2;
                upgradeTokenChance    = 2;
                break;
            }

            #endregion

            bool playerThresholdReached = false;

            int totalDamage       = 0;
            int totalPlayerDamage = 0;

            //Determine Total Damaged Inflicted and Per Player
            foreach (DamageEntry entry in DamageEntries)
            {
                if (!entry.HasExpired)
                {
                    Mobile damager = entry.Damager;

                    if (damager == null)
                    {
                        continue;
                    }

                    totalDamage += entry.DamageGiven;

                    PlayerMobile playerDamager = damager as PlayerMobile;

                    if (playerDamager != null)
                    {
                        totalPlayerDamage += entry.DamageGiven;
                    }

                    BaseCreature creatureDamager = damager as BaseCreature;

                    if (creatureDamager != null)
                    {
                        if (creatureDamager.ControlMaster is PlayerMobile)
                        {
                            totalPlayerDamage += entry.DamageGiven;
                        }
                    }
                }
            }

            foreach (DamageEntry entry in DamageEntries)
            {
                if (!entry.HasExpired && entry.DamageGiven > 0)
                {
                    PlayerMobile player = null;

                    Mobile damager = entry.Damager;

                    if (damager == null)
                    {
                        continue;
                    }
                    if (damager.Deleted)
                    {
                        continue;
                    }

                    PlayerMobile pm_Damager = damager as PlayerMobile;
                    BaseCreature bc_Damager = damager as BaseCreature;

                    if (pm_Damager != null)
                    {
                        player = pm_Damager;
                    }

                    if (bc_Damager != null)
                    {
                        if (bc_Damager.Controlled && bc_Damager.ControlMaster is PlayerMobile)
                        {
                            if (!bc_Damager.ControlMaster.Deleted)
                            {
                                player = bc_Damager.ControlMaster as PlayerMobile;
                            }
                        }
                    }

                    if (player != null)
                    {
                        if (m_PlayerDamageDealt.ContainsKey(player))
                        {
                            m_PlayerDamageDealt[player] += entry.DamageGiven;
                        }

                        else
                        {
                            m_PlayerDamageDealt.Add(player, entry.DamageGiven);
                        }
                    }
                }
            }

            Queue m_Queue = new Queue();

            foreach (KeyValuePair <PlayerMobile, int> playerEntry in m_PlayerDamageDealt)
            {
                PlayerMobile player = playerEntry.Key;
                int          damage = playerEntry.Value;

                if (player.IsUOACZUndead)
                {
                    double damagePercentOfTotal = (double)damage / totalDamage;

                    if (damage >= 100 || damagePercentOfTotal > .10)
                    {
                        UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadScore, scoreValue, true);

                        if (!player.m_UOACZAccountEntry.UndeadProfile.m_FormsKilledWith.Contains(player.m_UOACZAccountEntry.UndeadProfile.ActiveForm))
                        {
                            player.m_UOACZAccountEntry.UndeadProfile.m_FormsKilledWith.Add(player.m_UOACZAccountEntry.UndeadProfile.ActiveForm);
                        }

                        if (this is UOACZBaseCivilian)
                        {
                            player.m_UOACZAccountEntry.CiviliansKilledAsUndead++;
                        }

                        if (this is UOACZBaseMilitia)
                        {
                            player.m_UOACZAccountEntry.MilitiaKilledAsUndead++;
                        }

                        m_PotentialPlayers.Add(player);
                    }
                }

                else if (player.IsUOACZHuman)
                {
                    m_Queue.Enqueue(player);
                }
            }

            while (m_Queue.Count > 0)
            {
                PlayerMobile player = (PlayerMobile)m_Queue.Dequeue();

                player.SendMessage("You have killed a human.");

                UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.Honor, UOACZSystem.HumanKillCivilianHonorLoss, true);
            }

            double playerDamageRatio = (double)totalPlayerDamage / (double)totalDamage;
            double npcHelpScalar     = playerDamageRatio;

            if (m_PotentialPlayers.Count >= 3)
            {
                rewardChance          *= .75;
                corruptionStoneChance *= .75;
                upgradeTokenChance    *= .75;
            }

            if (m_PotentialPlayers.Count >= 5)
            {
                rewardChance          *= .75;
                corruptionStoneChance *= .75;
                upgradeTokenChance    *= .75;
            }

            rewardChance          *= UOACZPersistance.UndeadBalanceScalar;
            corruptionStoneChance *= UOACZPersistance.UndeadBalanceScalar;
            upgradeTokenChance    *= UOACZPersistance.UndeadBalanceScalar;

            foreach (PlayerMobile player in m_PotentialPlayers)
            {
                bool dropCorruptionStone = false;
                bool dropUpgradeToken    = false;

                if (Utility.RandomDouble() <= (rewardChance * npcHelpScalar))
                {
                    if (player.Backpack != null)
                    {
                        player.Backpack.DropItem(new UOACZBrains());
                        player.SendMessage(UOACZSystem.greenTextHue, "You have received a reward.");
                    }
                }

                if (Utility.RandomDouble() <= (corruptionStoneChance * npcHelpScalar))
                {
                    if (player.Backpack != null)
                    {
                        player.Backpack.DropItem(new UOACZCorruptionStone(player));
                        player.SendMessage(UOACZSystem.greenTextHue, "You have received a corruption stone.");
                    }
                }

                if (Utility.RandomDouble() <= (upgradeTokenChance * npcHelpScalar))
                {
                    if (player.Backpack != null)
                    {
                        player.Backpack.DropItem(new UOACZUndeadUpgradeToken(player));
                        player.SendMessage(UOACZSystem.greenTextHue, "You have received an upgrade token.");
                    }
                }
            }
        }