示例#1
0
 public override void OnDelete()
 {
     if (XmlScript.HasTrigger(this, TriggerName.onDelete))
     {
         UberScriptTriggers.Trigger(this, this.RootParentEntity as Mobile, TriggerName.onDelete);
     }
     base.OnDelete();
 }
示例#2
0
        public override bool OnDragDrop(Mobile from, Item item)
        {
            // trigger returns true if returnoverride
            if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) &&
                UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, item))
            {
                return(true);
            }
            return(XmlQuest.RegisterGive(from, this, item));

            //return base.OnDragDrop(from, item);
        }
示例#3
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (XmlScript.HasTrigger(this, TriggerName.onSpeech) &&
                UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech))
            {
                return;
            }
            if (!e.Handled && e.HasKeyword(Keyword) && e.Mobile.InRange(Location, 2))
            {
                e.Handled = true;

                Mobile from = e.Mobile;
                var    g    = from.Guild as Guild;

                var ethic = Ethics.Player.Find(e.Mobile);

                if (g == null && ethic == null || g != null && g.Type != Type && ethic == null)
                {
                    Say(SignupNumber);
                }
                else if (ethic != null && Shield is OrderShield && ethic.Ethic is EvilEthic ||
                         ethic != null && Shield is ChaosShield && ethic.Ethic is HeroEthic)
                {
                    Say("Begone!  You do not follow the proper ethic to wield one of our order's shields.");
                }
                else
                {
                    Container  pack      = from.Backpack;
                    BaseShield shield    = Shield;
                    Item       twoHanded = from.FindItemOnLayer(Layer.TwoHanded);

                    if ((pack != null && pack.FindItemByType(shield.GetType()) != null) ||
                        (twoHanded != null && shield.GetType().IsInstanceOfType(twoHanded)))
                    {
                        Say(1007110);                         // Why dost thou ask about virtue guards when thou art one?
                        shield.Delete();
                    }
                    else if (from.PlaceInBackpack(shield))
                    {
                        Say(Utility.Random(1007101, 5));
                        Say(1007139);                         // I see you are in need of our shield, Here you go.
                        from.AddToBackpack(shield);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502868);                         // Your backpack is too full.
                        shield.Delete();
                    }
                }
            }

            base.OnSpeech(e);
        }
示例#4
0
        // Alan Mod ===================================
        // this is when THIS container is added or removed from something
        public override void OnAdded(object parent)
        {
            if (parent is Item)
            {
                Item parentItem = (Item)parent;

                if (XmlScript.HasTrigger(this, TriggerName.onAdded))
                {
                    UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onAdded, parentItem);
                }
            }
            base.OnAdded(parent);
        }
示例#5
0
            protected override void OnTarget(Mobile from, object o)
            {
                var entity = o as IEntity;

                if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) &&
                    UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, m_Owner))
                {
                    return;
                }
                if (o is RecallRune)
                {
                    var rune = (RecallRune)o;

                    if (rune.Marked)
                    {
                        m_Owner.Effect(rune.Target, rune.TargetMap, true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(501803);                         // That rune is not yet marked.
                    }
                }
                else if (o is Runebook)
                {
                    RunebookEntry e = ((Runebook)o).Default;

                    if (e != null)
                    {
                        m_Owner.Effect(e.Location, e.Map, true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502354);                         // Target is not marked.
                    }
                }

                /*else if ( o is Key && ((Key)o).KeyValue != 0 && ((Key)o).Link is BaseBoat )
                 * {
                 * BaseBoat boat = ((Key)o).Link as BaseBoat;
                 *
                 * if ( !boat.Deleted && boat.CheckKey( ((Key)o).KeyValue ) )
                 *      m_Owner.Effect( boat.GetMarkedLocation(), boat.Map, false );
                 * else
                 *      from.Send( new MessageLocalized( from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 501030, from.Name, "" ) ); // I can not gate travel from that object.
                 * }*/
                else
                {
                    from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 501030, from.Name, ""));
                    // I can not gate travel from that object.
                }
            }
示例#6
0
            protected override void OnTarget(Mobile from, object o)
            {
                var entity = o as IEntity;

                if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) &&
                    UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, m_Owner))
                {
                    return;
                }
                if (o is IPoint3D)
                {
                    m_Owner.Target((IPoint3D)o);
                }
            }
示例#7
0
        public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage)
        {
            if (!CheckHold(from, dropped, sendFullMessage, true))
            {
                return(false);
            }

            if (XmlScript.HasTrigger(this, TriggerName.onDropIntoContainer) && UberScriptTriggers.Trigger(this, from, TriggerName.onDropIntoContainer, dropped)) // true if return override
            {
                return(false);
            }

            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null && house.IsLockedDown(this))
            {
                if (dropped is VendorRentalContract || (dropped is Container && ((Container)dropped).FindItemByType(typeof(VendorRentalContract)) != null))
                {
                    from.SendLocalizedMessage(1062492);                       // You cannot place a rental contract in a locked down container.
                    return(false);
                }

                if (!house.LockDown(from, dropped, false))
                {
                    return(false);
                }
            }

            List <Item> list = this.Items;

            for (int i = 0; i < list.Count; ++i)
            {
                Item item = list[i];

                if (!(item is Container) && item.StackWith(from, dropped, false))
                {
                    return(true);
                }
            }

            DropItem(dropped);

            // ARTEGORDONMOD
            // Begin mod for spawner release of items
            // set flag to have item taken off spawner list at next defrag
            ItemFlags.SetTaken(dropped, true);
            // End mod for spawner release of items

            return(true);
        }
示例#8
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            // trigger returns true if returnoverride
            if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped))
            {
                return(true);
            }
            if (IsAccessibleTo(from) && (dropped is PlagueBeastInnard || dropped is PlagueBeastGland))
            {
                return(base.OnDragDrop(from, dropped));
            }

            return(false);
        }
示例#9
0
        public override void OnRemoved(object parent)
        {
            if (parent is Item)
            {
                Item parentItem = (Item)parent;
                if (XmlScript.HasTrigger(this, TriggerName.onRemove))
                {
                    UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onRemove, parentItem);
                }
            }

            //Server.Engines.XmlSpawner2.XmlAttach.CheckOnRemoved(this, parent);
            base.OnRemoved(parent);
        }
示例#10
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            // trigger returns true if returnoverride
            if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) &&
                UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped))
            {
                return(true);
            }
            if (dropped is GoldenSkull)
            {
                dropped.Delete();

                PublicOverheadMessage(MessageType.Regular, 0x3B2, 1050046, from.Name);
                // Very well, ~1_NAME~, I accept your token. You may cross.
                BeginRemove(TimeSpan.FromSeconds(4.0));

                Party p = PartySystem.Party.Get(from);

                if (p != null)
                {
                    foreach (var pmi in p.Members)
                    {
                        Mobile member = pmi.Mobile;

                        if (member != @from && member.Map == Map.Malas && member.Region.IsPartOf("Doom"))
                        {
                            if (m_AngryAt == member)
                            {
                                m_AngryAt = null;
                            }

                            member.CloseGump(typeof(ChylothPartyGump));
                            member.SendGump(new ChylothPartyGump(@from, member));
                        }
                    }
                }

                if (m_AngryAt == from)
                {
                    m_AngryAt = null;
                }

                TeleportToFerry(from);

                return(false);
            }

            return(base.OnDragDrop(from, dropped));
        }
示例#11
0
        public override void OnRemoved(object parent)
        {
            if (parent is Mobile)
            {
                UberScriptTriggers.Trigger(this, (Mobile)parent, TriggerName.onUnequip);
            }
            else if (parent is Item)
            {
                Item parentItem = (Item)parent;
                UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onRemove, parentItem);
            }

            Server.Engines.XmlSpawner2.XmlAttach.CheckOnRemoved(this, parent);
            base.OnRemoved(parent);
        }
示例#12
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Potion != null && !m_Potion.Deleted && m_Potion.Map != Map.Internal)
                {
                    var mob = targeted as Mobile;
                    var p   = targeted as IPoint3D;

                    if (p != null)
                    {
                        Map map = from.Map;

                        if (map != null)
                        {
                            SpellHelper.GetSurfaceTop(ref p);

                            from.RevealingAction();

                            IEntity to = new Entity(Serial.Zero, new Point3D(p), map);

                            if (RelativeLocation && mob != null)
                            {
                                to = mob;
                            }

                            Effects.SendMovingEffect(from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0);

                            var entity = targeted as IEntity;
                            if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) &&
                                UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, m_Potion))
                            {
                                Effects.PlaySound(p, map, 0x307);
                                Effects.SendLocationEffect(p, map, 0x36BD, 9, 10, 0, 0);
                                m_Potion.Consume();
                                return;
                            }

                            if (m_Potion.Amount > 1)
                            {
                                Mobile.LiftItemDupe(m_Potion, 1);
                            }

                            m_Potion.Internalize();
                            Timer.DelayCall(TimeSpan.FromSeconds(1.0), m_Potion.Reposition_OnTick, new[] { from, to });
                        }
                    }
                }
            }
示例#13
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                var entity = targeted as IEntity;

                if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) &&
                    UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, m_Spell))
                {
                    return;
                }

                if (targeted is Mobile && m_Spell.CheckBSequence((Mobile)targeted))
                {
                    var targ = (Mobile)targeted;

                    SpellHelper.Turn(m_Spell.Caster, targ);

                    if (targ.BeginAction(typeof(LightCycle)))
                    {
                        new LightCycle.NightSightTimer(targ).Start();
                        var level =
                            (int)
                            (LightCycle.DungeonLevel *
                             ((from.EraAOS ? targ.Skills[SkillName.Magery].Value : from.Skills[SkillName.Magery].Value) / 100));

                        if (level < 0)
                        {
                            level = 0;
                        }

                        targ.LightLevel = level;

                        targ.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist);
                        targ.PlaySound(0x1E3);

                        BuffInfo.AddBuff(targ, new BuffInfo(BuffIcon.NightSight, 1075643));                         //Night Sight/You ignore lighting effects
                    }
                    else
                    {
                        from.SendMessage("{0} already have nightsight.", from == targ ? "You" : "They");
                    }
                }

                m_Spell.FinishSequence();
            }
示例#14
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            // trigger returns true if returnoverride
            if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) &&
                UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped))
            {
                return(true);
            }

            if (!TestCenter.Enabled && dropped is HouseDeed)
            {
                Faction fact = Faction.Find(from);

                if (FactionAllegiance != null && fact != null && FactionAllegiance != fact)
                {
                    Say("I will not do business with the enemy!");
                }
                else
                {
                    var deed  = (HouseDeed)dropped;
                    int price = ComputePriceFor(deed);

                    if (price > 0)
                    {
                        if (Banker.Deposit(from, TypeOfCurrency, price))
                        {
                            Say("For the deed I have placed {0} in your bank box : {1:#,0}", TypeOfCurrency.Name, price);

                            deed.Delete();
                            return(true);
                        }

                        Say(500390);                         // Your bank box is full.
                        return(false);
                    }

                    Say(500607);                     // I'm not interested in that.
                    return(false);
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
示例#15
0
            protected override void OnTarget(Mobile from, object o)
            {
                var entity = o as IEntity;

                if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) &&
                    UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, m_Owner))
                {
                    return;
                }

                if (o is TrapableContainer)
                {
                    m_Owner.Target((TrapableContainer)o);
                }
                else
                {
                    from.SendMessage("You can't trap that");
                }
            }
示例#16
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            // trigger returns true if returnoverride
            if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped))
            {
                return(true);
            }
            PlayerMobile player = from as PlayerMobile;

            if (player != null)
            {
                QuestSystem qs = player.Quest;

                if (qs is DarkTidesQuest)
                {
                    if (dropped is DarkTidesHorn)
                    {
                        if (player.Young)
                        {
                            DarkTidesHorn horn = (DarkTidesHorn)dropped;

                            if (horn.Charges < 10)
                            {
                                SayTo(from, 1049384);                                   // I have recharged the item for you.
                                horn.Charges = 10;
                            }
                            else
                            {
                                SayTo(from, 1049385);                                   // That doesn't need recharging yet.
                            }
                        }
                        else
                        {
                            player.SendLocalizedMessage(1114333);                               //You must be young to have this item recharged.
                        }

                        return(false);
                    }
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
示例#17
0
            protected override void OnTarget(Mobile from, object o)
            {
                var entity = o as IEntity;

                if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) &&
                    UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, m_Owner))
                {
                    return;
                }

                if (o is RecallRune)
                {
                    m_Owner.Target((RecallRune)o);
                }
                else
                {
                    from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 501797, from.Name, ""));
                    // I cannot mark that object.
                }
            }
示例#18
0
        public override bool OnDragDrop(Mobile from, Item item)
        {
            // trigger returns true if returnoverride
            if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, item))
            {
                return(true);
            }
            if (CheckFeed(from, item))
            {
                return(true);
            }

            if (PackAnimal.CheckAccess(this, from))
            {
                AddToBackpack(item);
                return(true);
            }

            return(base.OnDragDrop(from, item));
        }
示例#19
0
        public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
        {
            if (!CheckHold(from, item, true, true))
            {
                return(false);
            }

            if (XmlScript.HasTrigger(this, TriggerName.onDropIntoContainer) && UberScriptTriggers.Trigger(this, from, TriggerName.onDropIntoContainer, item)) // true if return override
            {
                return(false);
            }

            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null && house.IsLockedDown(this))
            {
                if (item is VendorRentalContract || (item is Container && ((Container)item).FindItemByType(typeof(VendorRentalContract)) != null))
                {
                    from.SendLocalizedMessage(1062492);                       // You cannot place a rental contract in a locked down container.
                    return(false);
                }

                if (!house.LockDown(from, item, false))
                {
                    return(false);
                }
            }

            item.Location = new Point3D(p.X, p.Y, 0);
            AddItem(item);

            from.SendSound(GetDroppedSound(item), GetWorldLocation());

            // ARTEGORDONMOD
            // Begin mod for spawner release of items
            // set flag to have item taken off spawner list at next defrag
            ItemFlags.SetTaken(item, true);
            // End mod for spawner release of items

            return(true);
        }
示例#20
0
        public override void OnSpeech(SpeechEventArgs args)
        {
            if (XmlScript.HasTrigger(this, TriggerName.onSpeech) && UberScriptTriggers.Trigger(this, args.Mobile, TriggerName.onSpeech, null, args.Speech))
            {
                return;
            }
            string said = args.Speech.ToLower();
            Mobile from = args.Mobile;

            if ((said.ToLower().IndexOf("new orders") >= 0) && (m_owner == from))
            {
                if (m_neworders)
                {
                    this.Say("You have some new orders!");
                }
                else
                {
                    this.Say("You have no new orders at this time.");
                }
            }
        }
示例#21
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (XmlScript.HasTrigger(this, TriggerName.onSpeech) && UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech))
            {
                return;
            }
            if (!e.Handled && e.Mobile.InRange(this, 6))
            {
                int[]  keywords = e.Keywords;
                string speech   = e.Speech;

                // Check for a greeting or 'Hire'
                if ((e.HasKeyword(0x003B)) || (e.HasKeyword(0x0162)))
                {
                    e.Handled = Payday(this);
                    this.SayHireCost();
                }
            }

            base.OnSpeech(e);
        }
示例#22
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            // trigger returns true if returnoverride
            if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped))
            {
                return(true);
            }
            bool bReturn = false;

            /*if( dropped is Head )  //Removed for bounty system removal
             * {
             *      int result = 0;
             *      int goldGiven = 0;
             *      bReturn = BountyKeeper.CollectBounty( (Head)dropped, from, this, ref goldGiven, ref result );
             *      switch(result)
             *      {
             *              case -2:
             *                      Say("You disgusting miscreant!  Why are you giving me an innocent person's head?");
             *                      break;
             *              case -3:
             *                      Say("I suspect treachery....");
             *                      Say("I'll take that head, you just run along now.");
             *                      break;
             *              case 1: //good, gold given
             *                      Say( string.Format("My thanks for slaying this vile person.  Here's the reward of {0} gold!", goldGiven) );
             *                      break;
             *              default:
             *                      if( bReturn )
             *                      {
             *                              Say("I'll take that.");
             *                      }
             *                      else
             *                      {
             *                              Say("I don't want that.");
             *                      }
             *                      break;
             *      }
             * }*/
            return(bReturn);
        }
示例#23
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (XmlScript.HasTrigger(this, TriggerName.onSpeech) && UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech))
            {
                return;
            }
            base.OnSpeech(e);
            Mobile from = e.Mobile;

            if (from.FindItemOnLayer(Layer.Helm) is NecromaticMask)
            {
                if (e.Speech.IndexOf("nwapslleh") >= 0)
                {
                    GreaterHealSpell gheal = new GreaterHealSpell(this, null); // get your spell
                    if (gheal.Cast())                                          // if it casts the spell
                    {
                        m_CastTimer = new GHCastTimer(gheal, from, gheal.GetCastDelay());
                        m_CastTimer.Start();
                    }
                }
            }
        }
示例#24
0
        public override void OnAdded(object parent)
        {
            if (parent is Mobile)
            {
                if (XmlScript.HasTrigger(this, TriggerName.onEquip) && UberScriptTriggers.Trigger(this, (Mobile)parent, TriggerName.onEquip))
                {
                    ((Mobile)parent).AddToBackpack(this); // override, put it in their pack
                    base.OnAdded(parent);
                    return;
                }

                Mobile from = (Mobile)parent;

                m_AosSkillBonuses.AddTo(from);
                m_AosAttributes.AddStatBonuses(from);

                if (m_Blessed && BlessedFor == null)
                {
                    BlessedFor = from;
                    LootType   = LootType.Blessed;
                }

                if (m_ChargeTime > 0)
                {
                    m_ChargeTime = m_MaxChargeTime;
                    StartTimer();
                }
            }
            else if (parent is Item)
            {
                Item parentItem = (Item)parent;
                if (XmlScript.HasTrigger(this, TriggerName.onAdded))
                {
                    UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onAdded, parentItem);
                }
            }

            InvalidateProperties();
        }
示例#25
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            // trigger returns true if returnoverride
            if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped))
            {
                return(true);
            }
            PlayerMobile player = from as PlayerMobile;

            if (player != null)
            {
                QuestSystem qs = player.Quest;

                if (qs is HaochisTrialsQuest)
                {
                    QuestObjective obj = qs.FindObjective(typeof(FourthTrialCatsObjective));

                    if (obj != null && !obj.Completed)
                    {
                        Gold gold = dropped as Gold;

                        if (gold != null)
                        {
                            obj.Complete();
                            qs.AddObjective(new FourthTrialReturnObjective(false));

                            SayTo(from, 1063241);                       // I thank thee.  This gold will be a great help to me and mine!

                            gold.Consume();                             // Intentional difference from OSI: don't take all the gold of poor newbies!
                            return(gold.Deleted);
                        }
                    }
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
示例#26
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            if (XmlScript.HasTrigger(this, TriggerName.onSpeech) &&
                UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech))
            {
                return;
            }

            if (!e.Handled && e.HasKeyword(0x0008))             // *stable*
            {
                e.Handled = true;

                CloseClaimList(e.Mobile);
                BeginStable(e.Mobile);
            }
            else if (!e.Handled && e.HasKeyword(0x0009))             // *claim*
            {
                e.Handled = true;

                CloseClaimList(e.Mobile);

                int index = e.Speech.IndexOf(' ');

                if (index != -1)
                {
                    Claim(e.Mobile, e.Speech.Substring(index).Trim());
                }
                else
                {
                    Claim(e.Mobile);
                }
            }
            else
            {
                base.OnSpeech(e);
            }
        }
示例#27
0
        public override void OnAdded(object parent)
        {
            // true if return override


            // XmlAttachment check for OnEquip and CanEquip
            if (parent is Mobile)
            {
                if (XmlScript.HasTrigger(this, TriggerName.onEquip) && UberScriptTriggers.Trigger(this, (Mobile)parent, TriggerName.onEquip))
                {
                    ((Mobile)parent).AddToBackpack(this); // override, put it in their pack
                    base.OnAdded(parent);
                    return;
                }

                /* Don't care about XmlSpawner no more!
                 * if (Server.Engines.XmlSpawner2.XmlAttach.CheckCanEquip(this, (Mobile)parent))
                 * {
                 *  Server.Engines.XmlSpawner2.XmlAttach.CheckOnEquip(this, (Mobile)parent);
                 * }
                 * else
                 * {
                 *  ((Mobile)parent).AddToBackpack(this);
                 * }*/
            }
            else if (parent is Item)
            {
                Item parentItem = (Item)parent;
                if (XmlScript.HasTrigger(this, TriggerName.onAdded))
                {
                    UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onAdded, parentItem);
                }
            }

            base.OnAdded(parent);
        }
示例#28
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            // trigger returns true if returnoverride
            if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped))
            {
                return(true);
            }
            PlayerMobile player = from as PlayerMobile;

            if (player != null)
            {
                UzeraanTurmoilQuest qs = player.Quest as UzeraanTurmoilQuest;

                if (qs != null && dropped is Apple && UzeraanTurmoilQuest.HasLostFertileDirt(from))
                {
                    FocusTo(from);

                    Item fertileDirt = new QuestFertileDirt();

                    if (!player.PlaceInBackpack(fertileDirt))
                    {
                        fertileDirt.Delete();
                        player.SendLocalizedMessage(1046260);                           // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                        return(false);
                    }
                    else
                    {
                        dropped.Consume();
                        qs.AddConversation(new DryadAppleConversation());
                        return(dropped.Deleted);
                    }
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
示例#29
0
        public void DoHarvest(ZombieAvatar pm, object targeted)
        {
            IEntity targetedEntity = targeted as IEntity;

            if (XmlScript.HasTrigger(targetedEntity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(targetedEntity, pm, TriggerName.onTargeted, this))
            {
                return;
            }

            CustomRegion customRegion = pm.Region as CustomRegion;

            if (customRegion != null && customRegion.Controller != null)
            {
                SkillName skill = SkillName.Spellweaving; // placeholder
                if (HarvestSystem is Mining)
                {
                    skill = SkillName.Mining;
                }

                if (customRegion.Controller.IsRestrictedSkill((int)skill))
                {
                    pm.SendMessage("You cannot use that skill here.");
                    return;
                }
            }

            //conquest skill check
            Skill tskill = null;

            if (HarvestSystem is Mining)
            {
                tskill = pm.Skills[SkillName.Mining];
            }

            HarvestSystem.StartHarvesting(pm, this, targeted);
        }
示例#30
0
        public bool Cast()
        {
            m_StartCastTime = DateTime.UtcNow;

            if (!m_Caster.CheckAlive())
            {
                return(false);
            }
            else if (m_Caster.Spell != null && m_Caster.Spell.IsCasting)
            {
                m_Caster.SendLocalizedMessage(502642);                 // You are already casting a spell.
            }
            else if (!(m_Scroll is BaseWand || m_Scroll is GnarledStaff) && (m_Caster.Paralyzed || m_Caster.Frozen))
            {
                m_Caster.SendLocalizedMessage(502643);                 // You can not cast a spell while frozen.
            }
            else if (CheckNextSpellTime && DateTime.UtcNow < m_Caster.NextSpellTime)
            {
                m_Caster.SendLocalizedMessage(502644);                 // You have not yet recovered from casting a spell.
            }
            else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow)
            {
                m_Caster.SendLocalizedMessage(1072060);                 // You cannot cast a spell while calmed.
            }
            #region Dueling
            else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null &&
                     !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast(m_Caster, this))
            {
            }
            #endregion

            else if (m_Caster.Mana >= ScaleMana(GetMana()))
            {
                if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast())
                {
                    if (XmlScript.HasTrigger(m_Caster, TriggerName.onBeginCast) &&
                        UberScriptTriggers.Trigger(m_Caster, m_Caster, TriggerName.onBeginCast, null, null, this))
                    {
                        return(false);
                    }
                    else if (m_Caster.Region.OnBeginSpellCast(m_Caster, this))
                    {
                        m_State        = SpellState.Casting;
                        m_Caster.Spell = this;

                        if (!(m_Scroll is BaseWand || m_Scroll is GnarledStaff) && RevealOnCast)
                        {
                            m_Caster.RevealingAction();
                        }

                        SayMantra();

                        TimeSpan castDelay = GetCastDelay();
                        var      count     = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);
                        if (ShowHandMovement && (m_Caster.Body.IsHuman || (m_Caster.Player && m_Caster.Body.IsMonster)))
                        {
                            if (count != 0)
                            {
                                m_AnimTimer = new AnimTimer(this, count);
                                m_AnimTimer.Start();
                            }

                            if (m_Info.LeftHandEffect > 0)
                            {
                                Caster.FixedParticles(0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand);
                            }

                            if (m_Info.RightHandEffect > 0)
                            {
                                Caster.FixedParticles(0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand);
                            }
                        }
                        //BaseCreature Animations For Casting
                        else if (m_Caster is BaseCreature)
                        {
                            if (count != 0 && Utility.Random(3) == 0 || (!m_Caster.Deleted && m_Caster.NetState != null))
                            // 1 in 3 chance that they do the animation
                            {
                                m_AnimTimer = new AnimTimer(this, count);
                                m_AnimTimer.Start();
                            }
                        }

                        if (ClearHandsOnCast)
                        {
                            m_Caster.ClearHands();
                        }

                        if (m_Caster.EraML)
                        {
                            WeaponAbility.ClearCurrentAbility(m_Caster);
                        }

                        m_CastTimer = new CastTimer(this, castDelay);
                        m_CastTimer.Start();

                        OnBeginCast();

                        return(true);
                    }
                }
                return(false);
            }
            else
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625);                 // Insufficient mana
            }

            return(false);
        }