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.");
        }
Exemple #2
0
        private static bool CanChange(PlayerMobile from, Race targetRace)
        {
            if (from.Deleted)
            {
                return(false);
            }

            if (from.Race == targetRace)
            {
                from.SendLocalizedMessage(1111918); // You are already that race.
            }
            else if (!MondainsLegacy.CheckML(from, false))
            {
                from.SendLocalizedMessage(1073651); // You must have Mondain's Legacy before proceeding...
            }
            else if (!from.Alive)
            {
                from.SendLocalizedMessage(1073646); // Only the living may proceed...
            }
            else if (from.Mounted)
            {
                from.SendLocalizedMessage(1073647); // You may not continue while mounted...
            }
            else if (!from.CanBeginAction <PolymorphSpell>() || DisguiseTimers.IsDisguised(from) ||
                     AnimalForm.UnderTransformation(from) || !from.CanBeginAction <IncognitoSpell>() ||
                     from.IsBodyMod)                // TODO: Does this cover everything?
            {
                from.SendLocalizedMessage(1073648); // You may only proceed while in your original state...
            }
            else if (from.Spell?.IsCasting == true)
            {
                from.SendLocalizedMessage(1073649); // One may not proceed while embracing magic...
            }
            else if (from.Poisoned)
            {
                from.SendLocalizedMessage(1073652); // You must be healthy to proceed...
            }
            else if (IsWearingEquipment(from))
            {
                from.SendLocalizedMessage(1073650); // To proceed you must be unburdened by equipment...
            }
            else
            {
                return(true);
            }

            return(false);
        }
Exemple #3
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);
        }
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

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

            if (DateTime.UtcNow < NextUsageAllowed)
            {
                player.SendMessage("That spyglass is currently in use.");
                return;
            }

            if (!player.CanBeginAction(typeof(Spyglass)))
            {
                player.SendMessage("You are already using a spyglass at the moment.");
                return;
            }

            player.SendSound(0x055);

            player.CloseGump(typeof(SpyglassGump));
            player.SendGump(new SpyglassGump(this, player, LastSearchMode, LastSearchLength));
        }
Exemple #5
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)
        {
            base.OnDoubleClick(from);

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

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

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

            from.SendMessage("Target the player or creature to target.");
            from.Target = new UOACZNetTarget(this);
        }
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile pm = (PlayerMobile)from;

            //AgatePlayerMobile apm = (AgatePlayerMobile)pm;

            if (!pm.Alive)
            {
                if (pm.InRange(GetWorldLocation(), 2))
                {
                    if (pm.CanBeginAction(new DeathTimer(pm)))
                    {
                        pm.Frozen = true;
                        pm.SendGump(new ResurrectionStoneGump(from));
                    }
                    else
                    {
                        var timer = pm.GetAction <DeathTimer>();
                        pm.SendMessage(Locale.GetLocale(pm).RESSURRECTION_STONE_WAIT, (timer.Next - DateTime.UtcNow).Seconds, (timer.Next - DateTime.UtcNow).Seconds == 1 ? null : "s");
                    }
                }
                else
                {
                    pm.SendLocalizedMessage(500446); // That is too far away.
                }
            }
            else
            {
                pm.SendMessage(Locale.GetLocale(pm).RESSURRECTION_STONE_NOT_DEAD);
            }
        }
Exemple #8
0
        public static void OnVirtueTargeted(Mobile from, object obj)
        {
            PlayerMobile protector = from as PlayerMobile;
            PlayerMobile pm        = obj as PlayerMobile;

            if (protector == null)
            {
                return;
            }

            if (!VirtueHelper.IsSeeker(protector, VirtueName.Justice))
            {
                protector.SendLocalizedMessage(1049610);                   // You must reach the first path in this virtue to invoke it.
            }
            else if (!protector.CanBeginAction(typeof(JusticeVirtue)))
            {
                protector.SendLocalizedMessage(1049370);                   // You must wait a while before offering your protection again.
            }
            else if (protector.JusticeProtectors.Count > 0)
            {
                protector.SendLocalizedMessage(1049542);                   // You cannot protect someone while being protected.
            }
            else if (protector.Map != Map.Felucca)
            {
                protector.SendLocalizedMessage(1049372);                   // You cannot use this ability here.
            }
            else if (pm == null)
            {
                protector.SendLocalizedMessage(1049678);                   // Only players can be protected.
            }
            else if (pm.Map != Map.Felucca)
            {
                protector.SendLocalizedMessage(1049372);                   // You cannot use this ability here.
            }
            else if (pm == protector || pm.Criminal || pm.Kills >= 5)
            {
                protector.SendLocalizedMessage(1049436);                   // That player cannot be protected.
            }
            else if (pm.Account == null || ((Account)pm.Account).Trial)
            {
                protector.SendLocalizedMessage(1111861);                   // Trial account players cannot be protected by another player.
            }
            else if (pm.JusticeProtectors.Count > 0)
            {
                protector.SendLocalizedMessage(1049369);                   // You cannot protect that player right now.
            }
            else if (pm.HasGump(typeof(AcceptProtectorGump)))
            {
                protector.SendLocalizedMessage(1049369);                   // You cannot protect that player right now.
            }
            else
            {
                pm.SendGump(new AcceptProtectorGump(protector, pm));
            }
        }
Exemple #9
0
        private static void EventSink_EquipLastWeaponMacroUsed(EquipLastWeaponMacroEventArgs e)
        {
            PlayerMobile pm = e.Mobile as PlayerMobile;

            if (!pm.CanBeginAction(typeof(EquipLastWeapon)))
            {
                pm.SendLocalizedMessage(500119);                   // You must wait to perform another action.
                return;
            }

            pm.BeginAction(typeof(EquipLastWeapon));

            Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(Expire_Callback), pm);

            if (pm != null && pm.Backpack != null)
            {
                BaseWeapon weapon = pm.LastEquipedWeapon;
                Item       hand1  = pm.FindItemOnLayer(Layer.OneHanded);
                Item       hand2  = pm.FindItemOnLayer(Layer.TwoHanded);

                if (weapon != null)
                {
                    if (!weapon.IsChildOf(pm.Backpack))
                    {
                        pm.SendLocalizedMessage(1063109);                           // Your last weapon must be in your backpack to be able to switch it quickly.
                        return;
                    }

                    if (weapon.Layer == Layer.TwoHanded && hand2 is BaseShield)
                    {
                        pm.SendLocalizedMessage(1063114);                           // You cannot pick up your last weapon!
                        return;
                    }

                    Item olditem = hand2 is BaseWeapon ? hand2 : hand1;

                    if (olditem != null && !pm.AddToBackpack(olditem))
                    {
                        pm.SendLocalizedMessage(1063110);                           // Your backpack cannot hold the weapon in your hand.
                    }
                    else if (pm.EquipItem(weapon))
                    {
                        pm.SendLocalizedMessage(1063112);                           // You pick up your last weapon.
                        pm.LastEquipedWeapon = olditem as BaseWeapon;
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1063113);                           // You put your weapon into your backpack, but cannot pick up your last weapon!
                    }
                }
            }
        }
Exemple #10
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            if (Core.TickCount - player.NextSkillTime < 0 || !player.CanBeginAction(typeof(ShepherdsCrook)))
            {
                player.SendMessage("You must wait a few moments before using another skill.");
                return;
            }

            if (player.AllFollowers.Count == 0)
            {
                player.SendMessage("You must have one or more followers in order to focus their aggression.");
                return;
            }

            int validFollowers = 0;

            foreach (BaseCreature creature in player.AllFollowers)
            {
                if (creature == null)
                {
                    continue;
                }
                if (!creature.Alive)
                {
                    continue;
                }
                if (Utility.GetDistance(player.Location, creature.Location) > 12)
                {
                    continue;
                }

                validFollowers++;
            }

            if (validFollowers == 0)
            {
                player.SendMessage("You do not have any followers close enough to hear your command.");
                return;
            }

            player.SendMessage("What do you wish to focus your follower's aggression towards?");
            player.Target = new FocusedAggressionTarget();
        }
Exemple #11
0
        public override void Invoke(ToolbarState state)
        {
            if (state == null)
            {
                return;
            }

            PlayerMobile user = state.User;

            if (user == null || user.Deleted || user.NetState == null)
            {
                return;
            }

            VitaNexCore.TryCatch(
                () =>
            {
                if (!user.CanBeginAction(this))
                {
                    return;
                }

                switch (TextType)
                {
                case MessageType.Whisper:
                    user.DoSpeech(FullValue, new int[0], TextType, user.WhisperHue);
                    break;

                case MessageType.Yell:
                    user.DoSpeech(FullValue, new int[0], TextType, user.YellHue);
                    break;

                default:
                    user.DoSpeech(FullValue, new int[0], TextType, user.SpeechHue);
                    break;
                }

                user.BeginAction(this);
                Timer.DelayCall(SpamDelay, () => user.EndAction(this));
            },
                ex =>
            {
                Console.WriteLine("{0} => {1} => ({2}) => {3}", user, GetType().Name, FullValue, ex);
                Toolbars.CMOptions.ToConsole(ex);
            });
        }
Exemple #12
0
        public bool ApplyMagicReflectEffect(PlayerMobile Wearer)
        {
            if (Wearer == null)
            {
                return(false);
            }

            Spell spell = new MagicReflectSpell(Wearer, null);

            if (Wearer.MagicDamageAbsorb > 0)
            {
                Wearer.SendMessage("The magic of this item is already protecting you.");
                return(false);
            }
            else if (Wearer.Region.OnBeginSpellCast(Wearer, spell) == false)
            {
                Wearer.SendMessage("The magic normally within this object seems absent.");
                return(false);
            }
            else if (!Wearer.CanBeginAction(typeof(DefensiveSpell)))
            {
                Wearer.SendLocalizedMessage(1005385);                   // The spell will not adhere to you at this time.
                return(false);
            }
            else
            {
                if (Wearer.BeginAction(typeof(DefensiveSpell)))
                {
                    int value = (int)((Utility.Random(51) + 50) + (Utility.Random(51) + 50)); // Random value of up to 100 for magery and up to 100 for scribing - lowest though is 50 magery/50 scribing equivalent strength
                    value = (int)(8 + (value / 200) * 7.0);                                   //absorb from 8 to 15 "circles"

                    Wearer.MagicDamageAbsorb = value;

                    Wearer.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
                    Wearer.PlaySound(0x1E9);
                    Wearer.SendMessage("You feel the magic of the item envelope you.");
                    return(true);
                }
                else
                {
                    Wearer.SendLocalizedMessage(1005385);                       // The spell will not adhere to you at this time.
                    return(false);
                }
            }
        }
Exemple #13
0
        public static void OnVirtueUsed(Mobile from)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            PlayerMobile protector = from as PlayerMobile;

            if (protector == null)
            {
                return;
            }

            Account acc = protector.Account as Account;

            if (acc == null || acc.Trial)
            {
                protector.SendLocalizedMessage(1111860);                   // Trial account players cannot offer protection to another player.
            }
            else if (!VirtueHelper.IsSeeker(protector, VirtueName.Justice))
            {
                protector.SendLocalizedMessage(1049610);                   // You must reach the first path in this virtue to invoke it.
            }
            else if (!protector.CanBeginAction(typeof(JusticeVirtue)))
            {
                protector.SendLocalizedMessage(1049370);                   // You must wait a while before offering your protection again.
            }
            else if (protector.JusticeProtectors.Count > 0)
            {
                protector.SendLocalizedMessage(1049542);                   // You cannot protect someone while being protected.
            }
            else if (protector.Map != Map.Felucca)
            {
                protector.SendLocalizedMessage(1049372);                   // You cannot use this ability here.
            }
            else
            {
                protector.BeginTarget(14, false, TargetFlags.None, new TargetCallback(OnVirtueTargeted));
                protector.SendLocalizedMessage(1049366);                   // Choose the player you wish to protect.
            }
        }
Exemple #14
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile pm = (PlayerMobile)from;

            if (pm.InRange(GetWorldLocation(), 2))
            {
                if (pm.CanBeginAction(this))
                {
                    pm.Frozen = true;
                    pm.SendGump(new TravelStoneGump(pm, this));
                }
                else
                {
                    pm.SendMessage(Locale.GetLocale(from).TRAVEL_STONE_TRAVELING);
                }
            }
            else
            {
                pm.SendLocalizedMessage(500446); // That is too far away.
            }
        }
Exemple #15
0
        public static void OnVirtueAccepted(PlayerMobile protector, PlayerMobile protectee)
        {
            if (!VirtueHelper.IsSeeker(protector, VirtueName.Justice))
            {
                protector.SendLocalizedMessage(1049610);                 // You must reach the first path in this virtue to invoke it.
            }
            else if (!protector.CanBeginAction(typeof(JusticeVirtue)))
            {
                protector.SendLocalizedMessage(1049370);                 // You must wait a while before offering your protection again.
            }
            else if (protector.JusticeProtectors.Count > 0)
            {
                protector.SendLocalizedMessage(1049542);                 // You cannot protect someone while being protected.
            }
            else if (protector.Map != Map.Felucca)
            {
                protector.SendLocalizedMessage(1049372);                 // You cannot use this ability here.
            }
            else if (protectee.Map != Map.Felucca)
            {
                protector.SendLocalizedMessage(1049372);                 // You cannot use this ability here.
            }
            else if (protectee == protector || protectee.Criminal || protectee.Murderer)
            {
                protector.SendLocalizedMessage(1049436);                 // That player cannot be protected.
            }
            else if (protectee.JusticeProtectors.Count > 0)
            {
                protector.SendLocalizedMessage(1049369);                 // You cannot protect that player right now.
            }
            else
            {
                protectee.JusticeProtectors.Add(protector);

                string args = string.Format("{0}\t{1}", protector.Name, protectee.Name);

                protectee.SendLocalizedMessage(1049451, args);                 // You are now being protected by ~1_NAME~.
                protector.SendLocalizedMessage(1049452, args);                 // You are now protecting ~2_NAME~.
            }
        }
Exemple #16
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);
        }
Exemple #17
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Book.Deleted)
            {
                return;
            }

            if (m_Book.IsChildOf(m_From.Backpack))
            {
                if (info.ButtonID == 1)
                {
                    //m_From.SendMessage( "You are turning to the previous page!" );
                    m_Book.Page--;

                    m_From.SendGump(new DaemonSpellGump((PlayerMobile)m_From, m_Book));
                }
                else if (info.ButtonID == 2)
                {
                    //m_From.SendMessage( "You are turning to the next page!" );
                    m_Book.Page++;

                    m_From.SendGump(new DaemonSpellGump((PlayerMobile)m_From, m_Book));
                }
                else if (info.ButtonID == 3)
                {
                    m_From.SendMessage("You are casting Unholy Gate!");

                    //new UnholyGateSpell(m_From);
                }
                else if (info.ButtonID == 4)                 //DEAMON FORM
                {
                    if ((m_From.BodyMod == 183 || m_From.BodyMod == 184) ||
                        (!m_From.CanBeginAction(typeof(IncognitoSpell)) || m_From.IsBodyMod) ||
                        (DisguiseTimers.IsDisguised(m_From)) ||
                        (!m_From.CanBeginAction(typeof(PolymorphSpell))) ||
                        (Factions.Sigil.ExistsOn(m_From))
                        )
                    {
                        m_From.SendMessage("You cannot obtain demonic power in that form.");
                    }
                    else
                    {
                        m_From.SendMessage("You are casting Daemon Form!");
                        new DaemonFormSpell(m_From);
                    }
                }
                else if (info.ButtonID == 5)
                {
                    m_From.SendMessage("You are casting Psi Explode!");
                }
                else if (info.ButtonID == 6)
                {
                    m_From.SendMessage("You are casting Soul Bleed!");
                }
                else if (info.ButtonID == 7)
                {
                    m_From.SendMessage("You are casting Possession!");
                }
                else if (info.ButtonID == 8)
                {
                    m_From.SendMessage("You are casting Mana Sheild!");
                }
                else if (info.ButtonID == 9)                 //SHADOW WALK
                {
                    if ((m_From.BodyMod == 183 || m_From.BodyMod == 184) ||
                        (!m_From.CanBeginAction(typeof(IncognitoSpell)) || m_From.IsBodyMod) ||
                        (DisguiseTimers.IsDisguised(m_From)) ||
                        (!m_From.CanBeginAction(typeof(PolymorphSpell))) ||
                        (Factions.Sigil.ExistsOn(m_From))
                        )
                    {
                        m_From.SendMessage("You cannot cast this spell in your current form!");
                    }
                    else
                    {
                        m_From.SendMessage("You are casting Shadow Walk!");

                        new ShadowWalkSpell(m_From);
                    }
                }
                else if (info.ButtonID == 10)                 //LAY AMBUSH
                {
                    m_From.SendMessage("You are casting Lay Ambush!");

                    m_From.Target = new LayAmbushTarget(m_From, m_Book);
                }
                else if (info.ButtonID == 11)                 //BONE WALL
                {
                    m_From.SendMessage("You are casting Bone Wall!");

                    m_From.Target = new BoneWallTarget(m_From, m_Book);
                }
                else if (info.ButtonID == 12)                 //IMPERSONATE
                {
                    if ((m_From.BodyMod == 183 || m_From.BodyMod == 184) ||
                        (!m_From.CanBeginAction(typeof(IncognitoSpell)) || m_From.IsBodyMod) ||
                        (DisguiseTimers.IsDisguised(m_From)) ||
                        (!m_From.CanBeginAction(typeof(PolymorphSpell))) ||
                        (Factions.Sigil.ExistsOn(m_From))
                        )
                    {
                        m_From.SendMessage("You cannot impersonate in that form.");
                    }
                    else
                    {
                        m_From.SendMessage("You are casting Impersonate!");
                        m_From.Target = new ImpersonateTarget(m_From, m_Book);
                    }
                }
            }
            else
            {
                m_From.SendMessage("The Spellbook must be in your backpack.");
            }
        }
Exemple #18
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_Torch == null)
                {
                    return;
                }
                if (m_Torch.Deleted)
                {
                    return;
                }

                IPoint3D location = target as IPoint3D;

                if (location == null)
                {
                    return;
                }

                Map map = player.Map;

                if (map == null)
                {
                    return;
                }

                SpellHelper.GetSurfaceTop(ref location);

                Mobile mobileTarget = null;

                targetLocation = new Entity(Serial.Zero, new Point3D(location), map);

                if (new Point3D(location) == from.Location)
                {
                    return;
                }

                if (!player.CanBeginAction(typeof(UOACZTorch)))
                {
                    player.SendMessage("You must wait a few moments before throwing another torch.");
                    return;
                }

                if (Utility.GetDistance(player.Location, targetLocation.Location) > ThrowRange)
                {
                    player.SendMessage("That location is too far away.");
                    return;
                }

                player.RevealingAction();

                SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, 1, true, 0, false, "", "", "-1");

                m_Torch.Delete();

                player.Animate(31, 7, 1, true, false, 0);

                int throwSound = 0x5D3;
                int hitSound   = 0x5CF;
                int itemID     = 2578;
                int itemHue    = 0;

                Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate
                {
                    if (!UOACZSystem.IsUOACZValidMobile(player))
                    {
                        return;
                    }
                    if (!player.IsUOACZHuman)
                    {
                        return;
                    }

                    player.BeginAction(typeof(UOACZTorch));

                    Timer.DelayCall(TimeSpan.FromSeconds(UOACZTorch.CooldownSeconds), delegate
                    {
                        if (player != null)
                        {
                            player.EndAction(typeof(UOACZTorch));
                        }
                    });

                    Effects.PlaySound(player.Location, player.Map, throwSound);

                    IEntity startLocation = new Entity(Serial.Zero, new Point3D(player.Location.X, player.Location.Y, player.Location.Z + 5), player.Map);
                    IEntity endLocation   = new Entity(Serial.Zero, new Point3D(targetLocation.Location.X, targetLocation.Location.Y, targetLocation.Location.Z + 5), targetLocation.Map);

                    Effects.SendMovingEffect(startLocation, endLocation, itemID, 15, 0, false, false, itemHue, 0);

                    double distance         = player.GetDistanceToSqrt(endLocation.Location);
                    double destinationDelay = (double)distance * .04;

                    Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                    {
                        Effects.PlaySound(endLocation.Location, endLocation.Map, hitSound);
                        Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3709, 10, 30, 0, 0, 5052, 0);

                        //Mobiles
                        Queue m_Queue = new Queue();

                        IPooledEnumerable nearbyMobiles = endLocation.Map.GetMobilesInRange(endLocation.Location, 0);

                        int mobilesHit = 0;

                        foreach (Mobile mobile in nearbyMobiles)
                        {
                            if (!UOACZSystem.IsUOACZValidMobile(mobile))
                            {
                                continue;
                            }

                            m_Queue.Enqueue(mobile);
                            mobilesHit++;
                        }

                        nearbyMobiles.Free();

                        while (m_Queue.Count > 0)
                        {
                            Mobile mobile = (Mobile)m_Queue.Dequeue();

                            BaseCreature bc_Target = mobile as BaseCreature;
                            PlayerMobile pm_Target = mobile as PlayerMobile;

                            int minDamage = 20;
                            int maxDamage = 40;

                            double damageScalar = 2;

                            if (pm_Target != null)
                            {
                                if (pm_Target.IsUOACZHuman)
                                {
                                    damageScalar = 0;
                                }

                                if (pm_Target.IsUOACZUndead)
                                {
                                    damageScalar = .66;
                                }
                            }

                            int damage = (int)(Math.Round(((double)Utility.RandomMinMax(minDamage, maxDamage)) * damageScalar));

                            bool humanSource = false;

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

                            if (damage > 0)
                            {
                                if (humanSource)
                                {
                                    player.DoHarmful(mobile);

                                    new Blood().MoveToWorld(mobile.Location, mobile.Map);
                                    AOS.Damage(mobile, player, damage, 100, 0, 0, 0, 0);
                                }

                                else
                                {
                                    new Blood().MoveToWorld(mobile.Location, mobile.Map);
                                    AOS.Damage(mobile, damage, 100, 0, 0, 0, 0);
                                }
                            }
                        }

                        if (mobilesHit > 0)
                        {
                            Effects.PlaySound(endLocation.Location, endLocation.Map, 0x054);
                            Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3709, 10, 30, 0, 0, 5052, 0);
                        }

                        bool oilLocationHit = false;

                        //Items
                        IPooledEnumerable nearbyItems = endLocation.Map.GetItemsInRange(endLocation.Location, 1);

                        foreach (Item item in nearbyItems)
                        {
                            if (item is UOACZOilLocation)
                            {
                                m_Queue.Enqueue(item);
                            }
                        }

                        nearbyItems.Free();

                        while (m_Queue.Count > 0)
                        {
                            UOACZOilLocation oilLocation = (UOACZOilLocation)m_Queue.Dequeue();

                            if (oilLocation == null)
                            {
                                continue;
                            }
                            if (oilLocation.Deleted)
                            {
                                continue;
                            }
                            if (oilLocation.Burning)
                            {
                                continue;
                            }

                            oilLocation.Ignite(player);
                            oilLocationHit = true;
                        }

                        if (!oilLocationHit)
                        {
                            Effects.PlaySound(endLocation.Location, endLocation.Map, 0x3BE);
                            Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3735, 10, 30, 0, 0, 5052, 0);
                        }
                    });
                });
            }
Exemple #19
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (from == null || m_Net == null)
                {
                    return;
                }
                if (from.Deleted || !from.Alive || m_Net.Deleted || m_Net.RootParent != from)
                {
                    return;
                }

                PlayerMobile player = from as PlayerMobile;

                if (player == null)
                {
                    return;
                }

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

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

                UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

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

                Mobile mobileTarget = null;

                if (target is Mobile)
                {
                    mobileTarget = target as Mobile;
                }

                else
                {
                    player.SendMessage("That is not a valid target.");
                    return;
                }

                if (mobileTarget == player)
                {
                    player.SendMessage("You cannot target yourself.");
                    return;
                }

                if (!UOACZSystem.IsUOACZValidMobile(mobileTarget))
                {
                    player.SendMessage("That is not a valid target.");
                    return;
                }

                if (Utility.GetDistance(player.Location, mobileTarget.Location) > 8)
                {
                    from.SendMessage("That is too far away");
                    return;
                }

                if (!player.Map.InLOS(player.Location, mobileTarget.Location))
                {
                    player.SendMessage("That is not within in your line of sight.");
                    return;
                }

                SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1, 1, true, 0, false, "", "", "-1");

                if (!from.Mounted)
                {
                    player.Animate(31, 7, 1, true, false, 0);
                }

                double duration = 60;

                if (mobileTarget is UOACZBaseWildlife)
                {
                    duration = 60;
                }

                if (mobileTarget is UOACZBaseUndead)
                {
                    UOACZBaseUndead bc_Undead = mobileTarget as UOACZBaseUndead;

                    double reduction = 1 - (bc_Undead.Difficulty * .10);

                    if (reduction < .10)
                    {
                        reduction = .10;
                    }

                    duration *= reduction;
                }

                if (mobileTarget is UOACZBaseHuman)
                {
                    UOACZBaseCivilian bc_Human = mobileTarget as UOACZBaseCivilian;

                    double reduction = 1 - (bc_Human.Difficulty * .10);

                    if (reduction < .10)
                    {
                        reduction = .10;
                    }

                    duration *= reduction;
                }

                PlayerMobile playerTarget = mobileTarget as PlayerMobile;

                if (playerTarget != null)
                {
                    if (playerTarget.IsUOACZHuman)
                    {
                        duration = Utility.RandomMinMax(2, 4);
                    }

                    if (playerTarget.IsUOACZUndead)
                    {
                        duration = Utility.RandomMinMax(5, 10);
                    }
                }

                UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);
                player.m_UOACZAccountEntry.NetsThrown++;

                int itemId  = m_Net.ItemID;
                int itemHue = m_Net.Hue;

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

                player.DoHarmful(mobileTarget);

                Point3D playerLocation = player.Location;
                Map     playerMap      = player.Map;

                Point3D mobileLocation = mobileTarget.Location;
                Map     mobileMap      = mobileTarget.Map;

                IEntity startLocation = new Entity(Serial.Zero, new Point3D(playerLocation.X, playerLocation.Y, playerLocation.Z + 7), playerMap);
                IEntity endLocation   = new Entity(Serial.Zero, new Point3D(mobileTarget.X, mobileTarget.Y, mobileTarget.Z), mobileMap);

                double distance         = from.GetDistanceToSqrt(endLocation);
                double destinationDelay = (double)distance * .08;

                m_Net.Delete();

                Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                {
                    if (!UOACZSystem.IsUOACZValidMobile(mobileTarget))
                    {
                        return;
                    }
                    if (Utility.GetDistance(playerLocation, mobileLocation) >= 25)
                    {
                        return;
                    }

                    SpecialAbilities.HinderSpecialAbility(1.0, player, mobileTarget, 1, duration, true, -1, true, "You ensnare them in a net", "You have been ensnared in a net!", "-1");

                    for (int a = 0; a < 9; a++)
                    {
                        TimedStatic net     = new TimedStatic(3538, duration - destinationDelay);
                        Point3D netLocation = mobileTarget.Location;

                        switch (a)
                        {
                        //Row 1
                        case 0:
                            net.ItemID  = 3538;
                            netLocation = new Point3D(netLocation.X - 1, netLocation.Y - 1, netLocation.Z);
                            break;

                        case 1:
                            net.ItemID  = 3528;
                            netLocation = new Point3D(netLocation.X, netLocation.Y - 1, netLocation.Z);
                            break;

                        case 2:
                            net.ItemID  = 3537;
                            netLocation = new Point3D(netLocation.X + 1, netLocation.Y - 1, netLocation.Z);
                            break;

                        //Row 2
                        case 3:
                            net.ItemID  = 3539;
                            netLocation = new Point3D(netLocation.X - 1, netLocation.Y, netLocation.Z);
                            break;

                        case 4:
                            net.ItemID  = 3530;
                            netLocation = new Point3D(netLocation.X, netLocation.Y, netLocation.Z);
                            break;

                        case 5:
                            net.ItemID  = 3531;
                            netLocation = new Point3D(netLocation.X + 1, netLocation.Y, netLocation.Z);
                            break;

                        //Row 3
                        case 6:
                            net.ItemID  = 3540;
                            netLocation = new Point3D(netLocation.X - 1, netLocation.Y + 1, netLocation.Z);
                            break;

                        case 7:
                            net.ItemID  = 3529;
                            netLocation = new Point3D(netLocation.X, netLocation.Y + 1, netLocation.Z);
                            break;

                        case 8:
                            net.ItemID  = 3541;
                            netLocation = new Point3D(netLocation.X + 1, netLocation.Y + 1, netLocation.Z);
                            break;
                        }

                        net.Hue  = itemHue;
                        net.Name = "a net";
                        net.MoveToWorld(netLocation, mobileMap);
                    }
                });
            }
        public static void Trick(BaseCreature creature, PlayerMobile player)
        {
            if (creature == null || player == null)
            {
                return;
            }

            int trickTextHue = 0x22;

            creature.PublicOverheadMessage(MessageType.Regular, trickTextHue, false, "Trick it is then!");
            creature.PlaySound(0x246);

            double damageAmount = 0;
            int    duration     = 0;

            switch (Utility.RandomMinMax(1, 15))
            {
            case 1:
                SpecialAbilities.BacklashSpecialAbility(1.0, null, player, .75, 60, -1, true, "", "");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Ack! A curse! Causing your spellcasting proficiency to suffer!", player.NetState);
                }
                break;

            case 2:
                double bleedAmount = (double)player.HitsMax * .66;

                for (int a = 0; a < 5; a++)
                {
                    Point3D newLocation = new Point3D(player.Location.X + Utility.RandomList(-1, 1), player.Location.Y + Utility.RandomList(-1, 1), player.Location.Z);

                    new Blood().MoveToWorld(newLocation, player.Map);
                }

                SpecialAbilities.BleedSpecialAbility(1.0, null, player, bleedAmount, 8, -1, true, "", "", "-1");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Curses! A dagger hidden in an apple!", player.NetState);
                }
                break;

            case 3:
                Point3D creatureLocation = creature.Location;
                Point3D playerLocation   = player.Location;

                int projectiles   = 15;
                int particleSpeed = 8;

                for (int a = 0; a < projectiles; a++)
                {
                    Point3D newLocation = new Point3D(player.X + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), player.Y + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), player.Z);
                    SpellHelper.AdjustField(ref newLocation, player.Map, 12, false);

                    IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z + 10), player.Map);
                    IEntity effectEndLocation   = new Entity(Serial.Zero, new Point3D(player.X, player.Y, player.Z + 10), player.Map);

                    Effects.SendMovingParticles(effectStartLocation, effectEndLocation, 0x3818, particleSpeed, 0, false, false, 2603, 0, 9501, 0, 0, 0x100);
                }

                player.FixedParticles(0x3967, 10, 40, 5036, 2603, 0, EffectLayer.CenterFeet);

                int damage = (int)(Math.Round((double)player.HitsMax * .33));

                duration = 5;

                SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, duration, false, -1, false, "", "", "-1");

                new Blood().MoveToWorld(player.Location, player.Map);
                AOS.Damage(player, damage, 0, 100, 0, 0, 0);

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Electric candy! What an age we live in!", player.NetState);
                }
                break;

            case 4:
                SpecialAbilities.DiseaseSpecialAbility(1.0, null, player, 3, 60, -1, true, "", "");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Blast! Expired candy!", player.NetState);
                }
                break;

            case 5:
                TimedStatic glue = new TimedStatic(4650, 30);
                glue.Name = "glue";
                glue.Hue  = 2067;
                glue.MoveToWorld(player.Location, player.Map);

                SpecialAbilities.EntangleSpecialAbility(1.0, null, player, 1.0, 30, -1, true, "", "", "-1");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Your feet have been glued to the floor!", player.NetState);
                }
                break;

            case 6:
                damageAmount = (double)player.HitsMax * .5;
                SpecialAbilities.FlamestrikeSpecialAbility(1.0, null, player, damageAmount, 1, -1, true, "", "Spicy candy! So hot!");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Spicy candy! So hot!", player.NetState);
                }
                break;

            case 7:
                damageAmount = (double)player.HitsMax * .5;

                Direction direction = Utility.GetDirection(creature.Location, player.Location);

                int windItemId = 8099;

                switch (direction)
                {
                case Direction.North: windItemId = 8099; break;

                case Direction.Right: windItemId = 8099; break;

                case Direction.West: windItemId = 8104; break;

                case Direction.Up: windItemId = 8104; break;

                case Direction.East: windItemId = 8109; break;

                case Direction.Down: windItemId = 8109; break;

                case Direction.South: windItemId = 8114; break;

                case Direction.Left: windItemId = 8114; break;
                }

                creature.MovingEffect(player, windItemId, 5, 1, false, false, 0, 0);
                player.PlaySound(0x64C);

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "This candy totally blows...", player.NetState);
                }

                SpecialAbilities.KnockbackSpecialAbility(1.0, creature.Location, null, player, damageAmount, 20, -1, "", "");
                break;

            case 8:
                SpecialAbilities.PetrifySpecialAbility(1.0, null, player, 1.0, 15, -1, true, "", "", "-1");

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Rock candy!", player.NetState);
                }
                break;

            case 9:
                if (player.Poison == null)
                {
                    Poison poison = Poison.GetPoison(2);
                    player.ApplyPoison(null, poison);
                }

                player.FixedEffect(0x372A, 10, 30, 2208, 0);
                Effects.PlaySound(player.Location, player.Map, 0x22F);

                int residueCount = Utility.RandomMinMax(3, 4);

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

                    TimedStatic poisonResidue = new TimedStatic(Utility.RandomList(0x1645, 0x122A, 0x122B, 0x122C, 0x122D, 0x122E, 0x122F), 5);
                    poisonResidue.Hue  = 2208;
                    poisonResidue.Name = "poison residue";
                    poisonResidue.MoveToWorld(poisonPoint, player.Map);
                }

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Poisoned candy! Who would do such a thing!", player.NetState);
                }
                break;

            case 10:
                bool canPolymorph = true;

                if (!player.CanBeginAction(typeof(PolymorphSpell)))
                {
                    canPolymorph = false;
                }

                if (!player.CanBeginAction(typeof(PolymorphPotion)))
                {
                    canPolymorph = false;
                }

                if (!player.CanBeginAction(typeof(IncognitoSpell)) || player.IsBodyMod)
                {
                    canPolymorph = false;
                }

                if (DisguiseTimers.IsDisguised(player))
                {
                    canPolymorph = false;
                }

                if (KinPaint.IsWearingKinPaint(player))
                {
                    canPolymorph = false;
                }

                if (!canPolymorph)
                {
                    player.SendMessage("Hmm...Nothing seems to have happened. Or did it?");
                    return;
                }

                player.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head);

                List <int> m_PossibleBodyValues = new List <int>();

                m_PossibleBodyValues.Add(3);     //Zombie
                m_PossibleBodyValues.Add(50);    //Skeleton
                m_PossibleBodyValues.Add(56);    //Skeleton
                m_PossibleBodyValues.Add(153);   //Ghoul
                m_PossibleBodyValues.Add(302);   //Skeletal Critter
                m_PossibleBodyValues.Add(309);   //Patchwork Skeleton
                m_PossibleBodyValues.Add(148);   //Necromancer
                m_PossibleBodyValues.Add(793);   //Skeletal Horse
                m_PossibleBodyValues.Add(317);   //Giant Bat
                m_PossibleBodyValues.Add(252);   //Corpse Bride
                m_PossibleBodyValues.Add(57);    //Skeletal Knight
                m_PossibleBodyValues.Add(116);   //Nightmare
                m_PossibleBodyValues.Add(24);    //Lich
                m_PossibleBodyValues.Add(154);   //Mummy
                m_PossibleBodyValues.Add(104);   //Skeletal Drake
                m_PossibleBodyValues.Add(740);   //Skeletal Drake
                m_PossibleBodyValues.Add(308);   //Giant Skeleton

                player.BodyMod = m_PossibleBodyValues[Utility.RandomMinMax(0, m_PossibleBodyValues.Count - 1)];
                player.HueMod  = 0;

                player.PlaySound(0x3BD);

                BaseArmor.ValidateMobile(player);

                duration = 120;

                player.BeginAction(typeof(PolymorphPotion));
                Timer.DelayCall(TimeSpan.FromSeconds(duration), delegate
                {
                    if (player == null)
                    {
                        return;
                    }

                    player.EndAction(typeof(PolymorphPotion));
                });

                player.BeginAction(typeof(PolymorphSpell));
                Timer.DelayCall(TimeSpan.FromSeconds(duration), delegate
                {
                    if (player == null)
                    {
                        return;
                    }

                    player.BodyMod = 0;
                    player.HueMod  = -1;
                    player.EndAction(typeof(PolymorphSpell));

                    BaseArmor.ValidateMobile(player);
                });

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Hmm, something tastes odd about this candy.", player.NetState);
                }
                break;

            case 11:
                Item innerLegs = player.FindItemOnLayer(Layer.InnerLegs);
                Item outerLegs = player.FindItemOnLayer(Layer.OuterLegs);
                Item pants     = player.FindItemOnLayer(Layer.Pants);

                int layersFound = 0;

                if (innerLegs != null)
                {
                    player.Backpack.DropItem(innerLegs);
                    layersFound++;
                }

                if (outerLegs != null)
                {
                    player.Backpack.DropItem(outerLegs);
                    layersFound++;
                }

                if (pants != null)
                {
                    player.Backpack.DropItem(pants);
                    layersFound++;
                }

                if (layersFound > 0)
                {
                    player.PlaySound(0x503);

                    if (player.NetState != null)
                    {
                        player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Your pants appear to have fallen down. How embarrassing!", player.NetState);
                    }
                }

                else
                {
                    player.SendMessage("Nothing seems to have happened. Or did it?...");
                }
                break;

            case 12:

                player.FixedParticles(0x374A, 10, 15, 5028, 2604, 0, EffectLayer.Waist);
                player.PlaySound(0x5DA);

                player.Animate(22, 6, 1, true, false, 0);     //Fall Forward

                player.Stam = 0;

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "You feel drowsy and fall on your face!", player.NetState);
                }
                break;

            case 13:
                player.BAC = 60;
                player.PlaySound(0x5A9);

                BaseBeverage.CheckHeaveTimer(player);

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

                if (player.NetState != null)
                {
                    player.PrivateOverheadMessage(MessageType.Regular, 0, false, "What was in that candy??? *hic*", player.NetState);
                }
                break;

            case 14:
                Warp(creature, player);
                break;

            case 15:
                Warp(creature, player);
                break;
            }
        }
Exemple #21
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (m_UOACZPickaxe.Deleted || m_UOACZPickaxe.RootParent != from)
                {
                    return;
                }
                PlayerMobile player = from as PlayerMobile;

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

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

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

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

                IPoint3D targetLocation = target as IPoint3D;

                if (targetLocation == null)
                {
                    return;
                }

                Map map = player.Map;

                if (map == null)
                {
                    return;
                }

                SpellHelper.GetSurfaceTop(ref targetLocation);

                Point3D location = new Point3D(targetLocation);

                UOACZScavengeOre scavengeOre = null;

                IPooledEnumerable nearbyItems = map.GetItemsInRange(location, 1);

                foreach (Item item in nearbyItems)
                {
                    if (item is UOACZScavengeOre)
                    {
                        scavengeOre = item as UOACZScavengeOre;
                        break;
                    }
                }

                nearbyItems.Free();

                if (target is UOACZScavengeOre)
                {
                    scavengeOre = target as UOACZScavengeOre;
                }

                if (scavengeOre != null)
                {
                    if (Utility.GetDistance(player.Location, scavengeOre.Location) > scavengeOre.InteractionRange)
                    {
                        from.SendMessage("You are too far away to use that.");
                        return;
                    }

                    int interactionCount = scavengeOre.GetInteractions(player);

                    if (scavengeOre.YieldsRemaining == 0 || interactionCount >= scavengeOre.MaxPlayerInteractions)
                    {
                        player.SendMessage(scavengeOre.NoYieldRemainingText);
                        return;
                    }

                    scavengeOre.Interact(player);
                }

                else
                {
                    from.SendMessage("The earth here is brittle and you must target a large ore formation in order to mine any significant amounts of ore.");
                    return;
                }
            }
Exemple #22
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.AccessLevel > AccessLevel.Player)
            {
                Open(from);
                return;
            }

            PlayerMobile player = from as PlayerMobile;

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

            if (Utility.GetDistance(player.Location, Location) > InteractionRange)
            {
                from.SendMessage("You are too far away to use that.");
                return;
            }

            if (!Map.InLOS(player.Location, Location))
            {
                from.SendMessage("That is not within your line of sight.");
                return;
            }

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

                ForceLock(player);
                return;
            }

            int searchCount = GetInteractions(player);

            if (YieldsRemaining == 0 || searchCount >= MaxPlayerInteractions)
            {
                player.SendMessage(NoYieldRemainingText);
                return;
            }

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

                if (!CanInteract(player))
                {
                    return;
                }

                Interact(player);
                return;
            }
        }
Exemple #23
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (m_Potion == null)
                {
                    return;
                }
                if (m_Potion.Deleted)
                {
                    return;
                }
                if (m_Player == null)
                {
                    return;
                }
                if (m_Player.Deleted || !m_Player.Alive)
                {
                    return;
                }

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

                Mobile mobileTarget = target as Mobile;

                if (mobileTarget == null)
                {
                    m_Player.SendMessage("That is not a creature or player.");
                    return;
                }

                if (m_Player.AccessLevel == AccessLevel.Player)
                {
                    if (!mobileTarget.CanBeDamaged() || !mobileTarget.Alive)
                    {
                        m_Player.SendMessage("That target cannot be damaged.");
                        return;
                    }

                    if (!mobileTarget.InLOS(m_Player) || mobileTarget.Hidden)
                    {
                        m_Player.SendMessage("That target is not in your line of sight.");
                        return;
                    }

                    if (!m_Player.CanBeginAction(typeof(CustomAlchemyPotion)))
                    {
                        from.SendMessage("You must wait before using another custom alchemy potion.");
                        return;
                    }
                }

                if (m_Potion.PositiveEffect && m_Player.AccessLevel == AccessLevel.Player)
                {
                    if (mobileTarget.NextCustomAlchemyPositiveEffectAllowed > DateTime.UtcNow)
                    {
                        string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, mobileTarget.NextCustomAlchemyPositiveEffectAllowed, false, true, true, true, true);

                        if (mobileTarget == m_Player)
                        {
                            m_Player.SendMessage("You must wait another " + timeRemaining + " before receieving additional beneficial effects from custom alchemy.");
                        }

                        else
                        {
                            m_Player.SendMessage("That target must wait another " + timeRemaining + " before receieving additional beneficial effects from custom alchemy.");
                        }

                        return;
                    }
                }

                ResolvePotion(m_Player, mobileTarget, m_Potion);
            }
Exemple #24
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (m_UOACZFishingPole.Deleted || m_UOACZFishingPole.RootParent != from)
                {
                    return;
                }
                if (from == null)
                {
                    return;
                }
                if (from.Deleted || !from.Alive)
                {
                    return;
                }

                PlayerMobile player = from as PlayerMobile;

                if (player == null)
                {
                    return;
                }

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

                IPoint3D targetLocation = target as IPoint3D;

                if (targetLocation == null)
                {
                    return;
                }

                Map map = player.Map;

                if (map == null)
                {
                    return;
                }

                SpellHelper.GetSurfaceTop(ref targetLocation);

                Point3D location = new Point3D(targetLocation);

                UOACZScavengeFishing scavengeFishing = null;

                IPooledEnumerable nearbyItems = map.GetItemsInRange(location, 1);

                foreach (Item item in nearbyItems)
                {
                    if (item is UOACZScavengeFishing)
                    {
                        scavengeFishing = item as UOACZScavengeFishing;
                        break;
                    }
                }

                nearbyItems.Free();

                if (target is UOACZScavengeFishing)
                {
                    scavengeFishing = target as UOACZScavengeFishing;
                }

                if (scavengeFishing != null)
                {
                    if (Utility.GetDistance(player.Location, scavengeFishing.Location) > scavengeFishing.InteractionRange)
                    {
                        from.SendMessage("You are too far away to use that.");
                        return;
                    }

                    int interactionCount = scavengeFishing.GetInteractions(player);

                    if (scavengeFishing.YieldsRemaining == 0 || interactionCount >= scavengeFishing.MaxPlayerInteractions)
                    {
                        player.SendMessage(scavengeFishing.NoYieldRemainingText);
                        return;
                    }

                    scavengeFishing.Interact(player);
                }

                else
                {
                    from.SendMessage("There doesn't appear to be fish there. You should look for water with fish swimming near the surface.");
                    return;
                }
            }
Exemple #25
0
        public static void AttemptPurchase(PlayerMobile player, UOACZRewardType rewardType)
        {
            if (player == null)
            {
                return;
            }
            if (player.Deleted || !player.Alive)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            if (UOACZSystem.IsUOACZValidMobile(player))
            {
                player.SendMessage("You may not purchase UOACZ Rewards while participating in a UOACZ session.");
                return;
            }

            UOACZRewardDetail rewardDetail = UOACZRewards.GetRewardDetail(rewardType);

            int rewardPointsAvailable = player.m_UOACZAccountEntry.RewardPoints;

            if (rewardDetail.RewardCost > rewardPointsAvailable && player.AccessLevel == AccessLevel.Player)
            {
                player.SendMessage("You don't have enough UOACZ Reward Points to purchase that.");
                return;
            }

            if (player.Backpack.Items.Count >= player.Backpack.MaxItems && player.AccessLevel == AccessLevel.Player)
            {
                player.SendMessage("You are carrying too many items to receive that item.");
                return;
            }

            bool madePurchase = false;

            switch (rewardType)
            {
            case UOACZRewardType.SurvivalTome:
                Item[] item = player.Backpack.FindItemsByType(typeof(UOACZSurvivalTome));

                if (item.Length == 0)
                {
                    if (player.Backpack.Items.Count < player.Backpack.MaxItems)
                    {
                        if (!player.CanBeginAction(typeof(UOACZSurvivalTome)))
                        {
                            player.SendMessage("You have acquired a Survival Tome too recently to acquire another one and must wait 10 minutes.");
                            return;
                        }

                        player.Backpack.DropItem(new UOACZSurvivalTome());
                        player.SendMessage("You recieve a UOACZ Survival Tome.");

                        madePurchase = true;

                        player.BeginAction(typeof(UOACZSurvivalTome));

                        Timer.DelayCall(TimeSpan.FromMinutes(10), delegate
                        {
                            if (player != null)
                            {
                                player.EndAction(typeof(UOACZSurvivalTome));
                            }
                        });
                    }

                    else
                    {
                        player.SendMessage("You are carrying too many items to receive that item.");
                        return;
                    }
                }

                else
                {
                    player.SendMessage("You already have a UOACZ Survival Tome in your backpack.");
                    return;
                }
                break;

            case UOACZRewardType.CorruptionTome:
                item = player.Backpack.FindItemsByType(typeof(UOACZCorruptionTome));

                if (item.Length == 0)
                {
                    if (player.Backpack.Items.Count < player.Backpack.MaxItems)
                    {
                        if (!player.CanBeginAction(typeof(UOACZCorruptionTome)))
                        {
                            player.SendMessage("You have acquired a Corruption Tome too recently to acquire another one and must wait 10 minutes.");
                            return;
                        }

                        player.Backpack.DropItem(new UOACZCorruptionTome());
                        player.SendMessage("You recieve a UOACZ Corruption Tome.");

                        madePurchase = true;

                        player.BeginAction(typeof(UOACZCorruptionTome));

                        Timer.DelayCall(TimeSpan.FromMinutes(10), delegate
                        {
                            if (player != null)
                            {
                                player.EndAction(typeof(UOACZCorruptionTome));
                            }
                        });
                    }

                    else
                    {
                        player.SendMessage("You are carrying too many items to receive that item.");
                        return;
                    }
                }

                else
                {
                    player.SendMessage("You already have a UOACZ Corruption Tome in your backpack.");
                    return;
                }

                break;

            case UOACZRewardType.SilverWeapon:
                BaseWeapon weapon = Loot.RandomWeapon();

                if (weapon != null)
                {
                    int accuracyLevel   = 1;
                    int damageLevel     = 1;
                    int durabilityLevel = 1;

                    double accuracyResult = Utility.RandomDouble();
                    double damageResult   = Utility.RandomDouble();

                    //Accuracy
                    if (accuracyResult <= .50)
                    {
                        accuracyLevel = 1;
                    }

                    else if (accuracyResult <= .90)
                    {
                        accuracyLevel = 2;
                    }

                    else if (accuracyResult <= .97)
                    {
                        accuracyLevel = 3;
                    }

                    else if (accuracyResult <= .99)
                    {
                        accuracyLevel = 4;
                    }

                    else
                    {
                        accuracyLevel = 5;
                    }

                    //Damage
                    if (damageResult <= .50)
                    {
                        damageLevel = 1;
                    }

                    else if (damageResult <= .90)
                    {
                        damageLevel = 2;
                    }

                    else if (damageResult <= .97)
                    {
                        damageLevel = 3;
                    }

                    else if (damageResult <= .99)
                    {
                        damageLevel = 4;
                    }

                    else
                    {
                        damageLevel = 5;
                    }

                    //Durability
                    durabilityLevel = Utility.RandomMinMax(1, 5);

                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)accuracyLevel;
                    weapon.DamageLevel     = (WeaponDamageLevel)damageLevel;
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)durabilityLevel;

                    madePurchase = true;

                    player.Backpack.DropItem(weapon);
                    player.SendMessage("You receive a silver weapon.");
                }
                break;

            case UOACZRewardType.UOACZLotteryTicket:
                UOACZLotteryTicket lotteryTicket = new UOACZLotteryTicket();

                if (lotteryTicket == null)
                {
                    return;
                }

                madePurchase = true;

                player.Backpack.DropItem(lotteryTicket);
                player.SendMessage("You receive a UOACZ Lottery Ticket.");
                break;

            case UOACZRewardType.LargeDecoration:
                Item largeItem = null;

                switch (Utility.RandomMinMax(1, 5))
                {
                case 1: largeItem = new UOACZDeadTree1RewardAddonDeed(); break;

                case 2: largeItem = new UOACZDeadTree2RewardAddonDeed(); break;

                case 3: largeItem = new UOACZDeadTree3RewardAddonDeed(); break;

                case 4: largeItem = new UOACZDeadTree4RewardAddonDeed(); break;

                case 5: largeItem = new UOACZDeadTree5RewardAddonDeed(); break;
                }

                if (largeItem == null)
                {
                    return;
                }

                madePurchase = true;

                player.Backpack.DropItem(largeItem);
                player.SendMessage("You receive a large reward item.");
                break;

            case UOACZRewardType.EpicDecoration:
                Item epicItem = new UOACZSkullPileRewardAddonDeed();

                if (epicItem == null)
                {
                    return;
                }

                madePurchase = true;

                player.Backpack.DropItem(epicItem);
                player.SendMessage("You receive an epic reward item.");
                break;
            }

            if (madePurchase)
            {
                player.SendSound(UOACZSystem.purchaseUpgradeSound);

                if (player.AccessLevel == AccessLevel.Player)
                {
                    player.m_UOACZAccountEntry.RewardPoints -= rewardDetail.RewardCost;
                }
            }
        }