Example #1
0
    void OnTriggerEnter(Collider c)
    {
        if (c.gameObject.tag == "Player")
        {
            HiddenBox hiddenbox = transform.parent.gameObject.GetComponent <HiddenBox> ();
            hiddenbox.contact = true;
        }

        Debug.Log(c.gameObject.tag + " Collision!");
    }
Example #2
0
        internal void UpdateVisibility()
        {
            if (ModelBox != null)
            {
                ModelBox.Visible = visible;
                ModelBox.Locked  = locked;
            }

            GraphicBox.Visible = visible && state.ShowGraphics;
            GraphicBox.Locked  = locked;

            if (HiddenBox != null)
            {
                HiddenBox.Visible = visible && state.ShowGraphics;
                HiddenBox.Locked  = locked;
            }

            TextBox.Visible = visible && graphicNode.TagVisible && state.ShowTags;
            TextBox.Locked  = locked;

            if (locked)
            {
                if (ModelBox != null)
                {
                    ModelBox.ZBottom();
                }

                GraphicBox.ZBottom();

                if (HiddenBox != null)
                {
                    HiddenBox.ZBottom();
                }

                TextBox.ZBottom();
            }
            else
            {
                if (ModelBox != null)
                {
                    ModelBox.ZIndex = GraphicBox.ZIndex + 100;
                    //linkHovered = false;
                    foreach (Arrow arrow in ModelBox.IncomingArrows)
                    {
                        (arrow.Tag as EditorLink).UpdateVisibility();
                        //arrow.ZIndex = Math.Max(arrow.Origin.ZIndex, arrow.Destination.ZIndex) + 10000;
                        //if ((arrow.Tag as EditorLink).Hovered)
                        //  linkHovered = true;
                    }
                    foreach (Arrow arrow in ModelBox.OutgoingArrows)
                    {
                        (arrow.Tag as EditorLink).UpdateVisibility();
                        // arrow.ZIndex = Math.Max(arrow.Origin.ZIndex, arrow.Destination.ZIndex) + 10000;
                        //if ((arrow.Tag as EditorLink).Hovered)
                        //  linkHovered = true;
                    }

                    ModelBox.CustomDraw = CustomDraw.Additional;
                }

                TextBox.ZIndex = GraphicBox.ZIndex + 200;

                if (HiddenBox != null)
                {
                    HiddenBox.ZBottom();
                }
            }

            opacityTimer.Start();
        }
Example #3
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckSequence())
            {
                /// WIZARD WANTS THIS TO WORK FOR NORMAL TRAPS, HIDDEN TRAPS, & HIDDEN CONTAINERS ///
                IPooledEnumerable TitemsInRange = Caster.Map.GetItemsInRange(new Point3D(p), 1 + (int)(Caster.Skills[SkillName.Magery].Value / 20.0));
                string            sTrap;
                foreach (Item item in TitemsInRange)
                {
                    if (item is BaseTrap)
                    {
                        BaseTrap trap = (BaseTrap)item;

                        if (trap is FireColumnTrap)
                        {
                            sTrap = "(fire column trap)";
                        }
                        else if (trap is FlameSpurtTrap)
                        {
                            sTrap = "(fire spurt trap)";
                        }
                        else if (trap is GasTrap)
                        {
                            sTrap = "(poison gas trap)";
                        }
                        else if (trap is GiantSpikeTrap)
                        {
                            sTrap = "(giant spike trap)";
                        }
                        else if (trap is MushroomTrap)
                        {
                            sTrap = "(mushroom trap)";
                        }
                        else if (trap is SawTrap)
                        {
                            sTrap = "(saw blade trap)";
                        }
                        else if (trap is SpikeTrap)
                        {
                            sTrap = "(spike trap)";
                        }
                        else if (trap is StoneFaceTrap)
                        {
                            sTrap = "(stone face trap)";
                        }
                        else
                        {
                            sTrap = "";
                        }

                        Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5024, 0);
                        Effects.PlaySound(item.Location, item.Map, 0x1FA);
                        Caster.SendMessage("There is a trap nearby! " + sTrap + "");
                    }
                    else if (item is HiddenTrap)
                    {
                        Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5024, 0);
                        Effects.PlaySound(item.Location, item.Map, 0x1FA);
                        Caster.SendMessage("There is a hidden floor trap somewhere nearby!");
                    }
                    else if (item is HiddenChest)
                    {
                        Caster.SendMessage("Your eye catches something nearby.");
                        string where = Server.Misc.Worlds.GetRegionName(Caster.Map, Caster.Location);

                        int money = Utility.RandomMinMax(50, 100);

                        int level = (int)(Caster.Skills[SkillName.Magery].Value / 16);
                        if (level < 1)
                        {
                            level = 1;
                        }
                        if (level > 6)
                        {
                            level = 6;
                        }

                        switch (Utility.RandomMinMax(1, level))
                        {
                        case 1: level = 1; break;

                        case 2: level = 2; break;

                        case 3: level = 3; break;

                        case 4: level = 4; break;

                        case 5: level = 5; break;

                        case 6: level = 6; break;
                        }

                        if (Utility.RandomMinMax(1, 3) > 1)
                        {
                            // DO NOTHING BECAUSE THE DETECT HIDDEN SKILL IS MUCH BETTER
                        }
                        else if (level > 4)
                        {
                            if (level == 5)
                            {
                                level = 1;
                            }
                            else
                            {
                                level = 2;
                            }

                            HiddenBox mBox = new HiddenBox(level, where, Caster);

                            Point3D loc = item.Location;
                            mBox.MoveToWorld(loc, Caster.Map);
                            Effects.SendLocationParticles(EffectItem.Create(mBox.Location, mBox.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5024, 0);
                            Effects.PlaySound(mBox.Location, mBox.Map, 0x1FA);
                        }
                        else
                        {
                            Gold coins = new Gold((money * level));

                            Point3D loc = item.Location;
                            coins.MoveToWorld(loc, Caster.Map);
                            Effects.SendLocationParticles(EffectItem.Create(coins.Location, coins.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5024, 0);
                            Effects.PlaySound(coins.Location, coins.Map, 0x1FA);
                        }

                        item.Delete();
                    }
                }
                TitemsInRange.Free();                 /////////////////////////////////////////////////////////////////////////////

                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                List <Mobile> targets = new List <Mobile>();

                Map map = Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 1 + (int)(Caster.Skills[SkillName.Magery].Value / 20.0));

                    foreach (Mobile m in eable)
                    {
                        if (m.Hidden && (m.AccessLevel == AccessLevel.Player || Caster.AccessLevel > m.AccessLevel) && CheckDifficulty(Caster, m))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = targets[i];

                    m.RevealingAction();

                    m.FixedParticles(0x375A, 9, 20, 5049, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, EffectLayer.Head);
                    m.PlaySound(0x1FD);
                }
            }

            FinishSequence();
        }
        public static bool DetectSomething(Item item, Mobile m, bool skillCheck)
        {
            bool   foundAnyone = false;
            string sTrap;

            bool foundIt = false;

            if (m.CheckSkill(SkillName.DetectHidden, 0, 125))
            {
                foundIt = true;
            }
            else if ((AosAttributes.GetValue(m, AosAttribute.NightSight) > 0 || m.LightLevel > 0) && 1 == Utility.RandomMinMax(1, 20))
            {
                foundIt = true;
            }

            if (m is PlayerMobile && m.Alive && (!skillCheck || foundIt))
            {
                if (item is BaseTrap)
                {
                    BaseTrap trap = (BaseTrap)item;

                    if (trap is FireColumnTrap)
                    {
                        sTrap = "(fire column trap)";
                    }
                    else if (trap is FlameSpurtTrap)
                    {
                        sTrap = "(fire spurt trap)";
                    }
                    else if (trap is GasTrap)
                    {
                        sTrap = "(poison gas trap)";
                    }
                    else if (trap is GiantSpikeTrap)
                    {
                        sTrap = "(giant spike trap)";
                    }
                    else if (trap is MushroomTrap)
                    {
                        sTrap = "(odd mushroom)";
                    }
                    else if (trap is SawTrap)
                    {
                        sTrap = "(saw blade trap)";
                    }
                    else if (trap is SpikeTrap)
                    {
                        sTrap = "(spike trap)";
                    }
                    else if (trap is StoneFaceTrap)
                    {
                        sTrap = "(stone face trap)";
                    }
                    else
                    {
                        sTrap = "";
                    }

                    Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                    Effects.PlaySound(item.Location, item.Map, 0x1FA);
                    m.SendMessage("There is a trap nearby! " + sTrap + "");
                    foundAnyone = true;
                }
                else if (item is BaseDoor && (item.ItemID == 0x35E ||
                                              item.ItemID == 0xF0 ||
                                              item.ItemID == 0xF2 ||
                                              item.ItemID == 0x326 ||
                                              item.ItemID == 0x324 ||
                                              item.ItemID == 0x32E ||
                                              item.ItemID == 0x32C ||
                                              item.ItemID == 0x314 ||
                                              item.ItemID == 0x316 ||
                                              item.ItemID == 0x31C ||
                                              item.ItemID == 0x31E ||
                                              item.ItemID == 0xE8 ||
                                              item.ItemID == 0xEA ||
                                              item.ItemID == 0x34C ||
                                              item.ItemID == 0x356 ||
                                              item.ItemID == 0x35C ||
                                              item.ItemID == 0x354 ||
                                              item.ItemID == 0x344 ||
                                              item.ItemID == 0x346 ||
                                              item.ItemID == 0x34E ||
                                              item.ItemID == 0x334 ||
                                              item.ItemID == 0x336 ||
                                              item.ItemID == 0x33C ||
                                              item.ItemID == 0x33E))
                {
                    Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                    Effects.PlaySound(item.Location, item.Map, 0x1FA);
                    m.SendMessage("There is a hidden door nearby!");
                    foundAnyone = true;
                }
                else if (item is HiddenTrap)
                {
                    string textSay = "There is a hidden floor trap somewhere nearby!";
                    if (Server.Misc.Worlds.IsOnSpaceship(item.Location, item.Map))
                    {
                        textSay = "There is a dangerous area nearby!";
                    }
                    Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                    Effects.PlaySound(item.Location, item.Map, 0x1FA);
                    m.SendMessage(textSay);
                    foundAnyone = true;
                }
                else if (item is HiddenChest)
                {
                    m.SendMessage("Your eye catches something nearby.");
                    Map map = m.Map;
                    string where = Server.Misc.Worlds.GetRegionName(m.Map, m.Location);

                    int money = Utility.RandomMinMax(100, 200);

                    int level = (int)(m.Skills[SkillName.DetectHidden].Value / 10);
                    if (level < 1)
                    {
                        level = 1;
                    }
                    if (level > 10)
                    {
                        level = 10;
                    }

                    switch (Utility.RandomMinMax(1, level))
                    {
                    case 1: level = 1; break;

                    case 2: level = 2; break;

                    case 3: level = 3; break;

                    case 4: level = 4; break;

                    case 5: level = 5; break;

                    case 6: level = 6; break;

                    case 7: level = 7; break;

                    case 8: level = 8; break;

                    case 9: level = 9; break;

                    case 10: level = 10; break;
                    }

                    if (Utility.RandomMinMax(1, 3) > 1)
                    {
                        Item coins = new Gold((money * level));

                        if (Server.Misc.Worlds.IsOnSpaceship(item.Location, item.Map))
                        {
                            coins.Delete(); coins = new DDXormite(); coins.Amount = (int)((money * level) / 3);
                        }
                        else if (Server.Misc.Worlds.GetMyWorld(item.Map, item.Location, item.X, item.Y) == "the Underworld")
                        {
                            coins.Delete(); coins = new DDJewels(); coins.Amount = (int)((money * level) / 2);
                        }
                        else if (Utility.RandomMinMax(1, 100) > 99)
                        {
                            coins.Delete(); coins = new DDGemstones(); coins.Amount = (int)((money * level) / 2);
                        }
                        else if (Utility.RandomMinMax(1, 100) > 95)
                        {
                            coins.Delete(); coins = new DDGoldNuggets(); coins.Amount = (int)((money * level));
                        }
                        else if (Utility.RandomMinMax(1, 100) > 80)
                        {
                            coins.Delete(); coins = new DDSilver(); coins.Amount = (int)((money * level) * 5);
                        }
                        else if (Utility.RandomMinMax(1, 100) > 60)
                        {
                            coins.Delete(); coins = new DDCopper(); coins.Amount = (int)((money * level) * 10);
                        }

                        Point3D loc = item.Location;
                        coins.MoveToWorld(loc, map);
                        Effects.SendLocationParticles(EffectItem.Create(coins.Location, coins.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                        Effects.PlaySound(coins.Location, coins.Map, 0x1FA);
                    }
                    else
                    {
                        HiddenBox mBox = new HiddenBox(level, where, m);

                        Point3D loc = item.Location;
                        mBox.MoveToWorld(loc, map);
                        Effects.SendLocationParticles(EffectItem.Create(mBox.Location, mBox.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
                        Effects.PlaySound(mBox.Location, mBox.Map, 0x1FA);
                    }

                    foundAnyone = true;
                    item.Delete();
                }
            }
            return(foundAnyone);
        }