示例#1
0
        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);
        }
示例#2
0
            protected override void OnTick()
            {
                int  z      = m_Map.GetAverageZ(m_X, m_Y);
                bool canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false);

                for (int i = -3; !canFit && i <= 3; ++i)
                {
                    canFit = m_Map.CanFit(m_X, m_Y, z + i, 6, false, false);

                    if (canFit)
                    {
                        z += i;
                    }
                }

                if (!canFit)
                {
                    return;
                }

                Item g = new Gold(100, 200); g.Delete();

                switch (Utility.Random(7))
                {
                case 0: g = new DDJewels(50, 100); break;

                case 1: g = new Gold(100, 200); break;

                case 2: g = new DDSilver(200, 300); break;

                case 3: g = new DDSilver(200, 300); break;

                case 4: g = new DDCopper(300, 400); break;

                case 5: g = new DDCopper(300, 400); break;

                case 6: g = new DDCopper(300, 400); break;
                }

                g.MoveToWorld(new Point3D(m_X, m_Y, z), m_Map);

                if (0.5 >= Utility.RandomDouble())
                {
                    switch (Utility.Random(3))
                    {
                    case 0:                             // Fire column
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                        Effects.PlaySound(g, g.Map, 0x208);

                        break;
                    }

                    case 1:                             // Explosion
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044);
                        Effects.PlaySound(g, g.Map, 0x307);

                        break;
                    }

                    case 2:                             // Ball of fire
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052);

                        break;
                    }
                    }
                }
            }
            protected override void OnTick()
            {
                int  z      = m_Map.GetAverageZ(m_X, m_Y);
                bool canFit = m_Map.CanFit(m_X, m_Y, z, 6, false, false);

                for (int i = -3; !canFit && i <= 3; ++i)
                {
                    canFit = m_Map.CanFit(m_X, m_Y, z + i, 6, false, false);

                    if (canFit)
                    {
                        z += i;
                    }
                }

                if (!canFit)
                {
                    return;
                }

                Item g = new Gold(100, 200); g.Delete();

                int r1 = (int)(Utility.RandomMinMax(80, 160) * (MyServerSettings.GetGoldCutRate() * .01));
                int r2 = (int)(Utility.RandomMinMax(200, 400) * (MyServerSettings.GetGoldCutRate() * .01));
                int r3 = (int)(Utility.RandomMinMax(400, 800) * (MyServerSettings.GetGoldCutRate() * .01));
                int r4 = (int)(Utility.RandomMinMax(800, 1200) * (MyServerSettings.GetGoldCutRate() * .01));
                int r5 = (int)(Utility.RandomMinMax(1200, 1600) * (MyServerSettings.GetGoldCutRate() * .01));

                switch (Utility.Random(21))
                {
                case 0: g = new Crystals(r1); break;

                case 1: g = new DDGemstones(r2); break;

                case 2: g = new DDJewels(r2); break;

                case 3: g = new DDGoldNuggets(r3); break;

                case 4: g = new Gold(r3); break;

                case 5: g = new Gold(r3); break;

                case 6: g = new Gold(r3); break;

                case 7: g = new DDSilver(r4); break;

                case 8: g = new DDSilver(r4); break;

                case 9: g = new DDSilver(r4); break;

                case 10: g = new DDSilver(r4); break;

                case 11: g = new DDSilver(r4); break;

                case 12: g = new DDSilver(r4); break;

                case 13: g = new DDCopper(r5); break;

                case 14: g = new DDCopper(r5); break;

                case 15: g = new DDCopper(r5); break;

                case 16: g = new DDCopper(r5); break;

                case 17: g = new DDCopper(r5); break;

                case 18: g = new DDCopper(r5); break;

                case 19: g = new DDCopper(r5); break;

                case 20: g = new DDCopper(r5); break;
                }

                g.MoveToWorld(new Point3D(m_X, m_Y, z), m_Map);

                if (0.5 >= Utility.RandomDouble())
                {
                    switch (Utility.Random(3))
                    {
                    case 0:                             // Fire column
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                        Effects.PlaySound(g, g.Map, 0x208);

                        break;
                    }

                    case 1:                             // Explosion
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36BD, 20, 10, 5044);
                        Effects.PlaySound(g, g.Map, 0x307);

                        break;
                    }

                    case 2:                             // Ball of fire
                    {
                        Effects.SendLocationParticles(EffectItem.Create(g.Location, g.Map, EffectItem.DefaultDuration), 0x36FE, 10, 10, 5052);

                        break;
                    }
                    }
                }
            }