public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("O item precisa estar na sua bag");                   // That must be in your pack for you to use it.
            }
            else if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                from.SendMessage("Voce e GM e pode colocar o vendedor onde quiser."); // Your godly powers allow you to place this vendor whereever you wish.

                Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from));

                v.Direction = from.Direction & Direction.Mask;
                v.MoveToWorld(from.Location, from.Map);

                v.SayTo(from, "Ah! Como e bom voltar ao trabalho...");                   // Ah! it feels good to be working again.

                this.Delete();
            }
            else
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house == null)
                {
                    from.SendMessage("Vendedores so podem ser colocados dentro de casa"); // Vendors can only be placed in houses.
                }
                else if (!BaseHouse.NewVendorSystem && !house.IsFriend(from))
                {
                    from.SendMessage("Apenas o dono, sócios e amigos podem colocar vendedores nesta casa"); // You must ask the owner of this building to name you a friend of the household in order to place a vendor here.
                }
                else if (BaseHouse.NewVendorSystem && !house.IsOwner(from))
                {
                    from.SendMessage("Apenas o dono pode colocar vendedores diretamente."); // Only the house owner can directly place vendors.  Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house.
                }
                else if (!house.Public || !house.CanPlaceNewVendor())
                {
                    from.SendMessage("Voce nao pode colocar este vendedor aqui. Verifique se a casa e publica e tem espaco suficiente."); // You cannot place this vendor or barkeep.  Make sure the house is public and has sufficient storage available.
                }
                else
                {
                    bool vendor, contract;
                    BaseHouse.IsThereVendor(from.Location, from.Map, out vendor, out contract);

                    if (vendor)
                    {
                        from.SendMessage("Voce nao pode colocar um vendedor aqui"); // You cannot place a vendor or barkeep at this location.
                    }
                    else if (contract)
                    {
                        from.SendMessage("Voce nao pode colocar este vendedor aqui, verifique o contrato."); // You cannot place a vendor or barkeep on top of a rental contract!
                    }
                    else
                    {
                        Mobile v = new PlayerVendor(from, house);

                        v.Direction = from.Direction & Direction.Mask;
                        v.MoveToWorld(from.Location, from.Map);

                        v.SayTo(from, "Ah! Como e bom voltar ao trabalho...");                          // Ah! it feels good to be working again.

                        this.Delete();
                    }
                }
            }
        }
        public bool IsOwner(Mobile mob)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            return(house != null && house.IsOwner(mob));
        }
Ejemplo n.º 3
0
        public static bool InHouse(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(from);

            return(house != null && house.IsCoOwner(from));
        }
Ejemplo n.º 4
0
        public Point3D GetSpawnPosition(ISpawnable spawned)
        {
            Map map = Map;

            if (map == null)
            {
                return(Location);
            }

            bool waterMob, waterOnlyMob;

            if (spawned is Mobile)
            {
                Mobile mob = (Mobile)spawned;

                waterMob     = mob.CanSwim;
                waterOnlyMob = (mob.CanSwim && mob.CantWalk);
            }
            else
            {
                waterMob     = false;
                waterOnlyMob = false;
            }

            for (int i = 0; i < 10; ++i)
            {
                int x = GetAdjustedLocation(m_HomeRange, m_SpawnArea.Width, m_SpawnArea.X, X);
                int y = GetAdjustedLocation(m_HomeRange, m_SpawnArea.Height, m_SpawnArea.Y, Y);

                int mapZ = map.GetAverageZ(x, y);

                if (m_IgnoreHousing || ((BaseHouse.FindHouseAt(new Point3D(x, y, mapZ), Map, 16) == null &&
                                         BaseHouse.FindHouseAt(new Point3D(x, y, this.Z), Map, 16) == null)))
                {
                    if (waterMob)
                    {
                        if (IsValidWater(map, x, y, this.Z))
                        {
                            return(new Point3D(x, y, this.Z));
                        }
                        else if (IsValidWater(map, x, y, mapZ))
                        {
                            return(new Point3D(x, y, mapZ));
                        }
                    }

                    if (!waterOnlyMob)
                    {
                        if (map.CanSpawnMobile(x, y, this.Z))
                        {
                            return(new Point3D(x, y, this.Z));
                        }
                        else if (map.CanSpawnMobile(x, y, mapZ))
                        {
                            return(new Point3D(x, y, mapZ));
                        }
                    }
                }
            }

            return(this.Location);
        }
Ejemplo n.º 5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item.QuestItem)
                    {
                        from.SendLocalizedMessage(1151836); // You may not dye toggled quest items.
                    }
                    else if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                            m_Tub.Charges--;
                            m_Tub.CheckEmpty();
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    // Scriptiz : ajout pour rendre les addon furniture dyable  && !(item is AddonComponent)
                                    if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item) && !(item is AddonComponent)))
                                    {
                                        from.SendLocalizedMessage(501022);                                           // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023);                                           // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135);                                       // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                                m_Tub.Charges--;
                                m_Tub.CheckEmpty();
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776);                               // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                            m_Tub.Charges--;
                            m_Tub.CheckEmpty();
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779);                               // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                            m_Tub.Charges--;
                            m_Tub.CheckEmpty();
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded) || item is ElvenBoots || item is WoodlandBelt) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419);                               // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                            m_Tub.Charges--;
                            m_Tub.CheckEmpty();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
Ejemplo n.º 6
0
        public bool CanUse(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            return(house != null && house.HasSecureAccess(from, Level));
        }
Ejemplo n.º 7
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            /*
             * Unique problems have unique solutions.  OSI does not have a problem with 1000s of mining carts
             * due to the fact that they have only a miniscule fraction of the number of 10 year vets that a
             * typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem),
             * and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid)
             * accounts not gaining veteran time.
             *
             * The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking
             * behavior of these things all but impossible, so either way its just an estimation.
             *
             * If youd like your shard's carts/stumps to work the way they did before, simply replace the check
             * below with this line of code:
             *
             * if (!from.InRange(GetWorldLocation(), 2)
             *
             * However, I am sure these checks are more accurate to OSI than the former version was.
             *
             */

            if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - Z) > -3 && (from.Z - Z) < 3))
            {
                from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            }
            else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
            {
                if (m_Logs > 0)
                {
                    Item logs = null;

                    switch (Utility.Random(7))
                    {
                    case 0: logs = new Log(); break;

                    case 1: logs = new AshLog(); break;

                    case 2: logs = new OakLog(); break;

                    case 3: logs = new YewLog(); break;

                    case 4: logs = new HeartwoodLog(); break;

                    case 5: logs = new BloodwoodLog(); break;

                    case 6: logs = new FrostwoodLog(); break;
                    }

                    int amount = Math.Min(10, m_Logs);
                    logs.Amount = amount;

                    if (!from.PlaceInBackpack(logs))
                    {
                        logs.Delete();
                        from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again.
                    }
                    else
                    {
                        m_Logs -= amount;
                        PublicOverheadMessage(MessageType.Regular, 0, 1094719, m_Logs.ToString()); // Logs: ~1_COUNT~
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1094720); // There are no more logs available.
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637); // You are not allowed to access this.
            }
        }
Ejemplo n.º 8
0
        public override void OnDoubleClick(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(from);

            TownshipRegion tr = TownshipRegion.GetTownshipAt(from);

            if (house == null)
            {
                from.SendMessage("You must be in a house to place this vendor.");
            }
            else if (tr == null)
            {
                from.SendMessage("You must be in a township to place this vendor.");
            }
            else if (!house.IsCoOwner(from))
            {
                from.SendMessage("You must be a coowner of the house to place this vendor.");
            }
            else if (!tr.CanBuildHouseInTownship(from))
            {
                from.SendMessage("You must be a guildmate to place this vendor.");
            }
            else if (!tr.CanBuildHouseInTownship(house.Owner))
            {
                from.SendMessage("The house must be owned by a guildmember to place this vendor.");
            }
            else if (!house.Public)
            {
                from.SendMessage("This vendor must be placed in a public house.");
            }
            else if (tr.TStone.Guild.Abbreviation != this.m_GuildAbbr)
            {
                from.SendMessage("This vendor must be placed in your guild's town.");
            }
            else
            {
                bool bCanPlace = true;

                int playervendorCount = 0;
                int tsnpcCount        = 0;

                foreach (Mobile mx in house.Region.Mobiles.Values)
                {
                    if (mx is PlayerVendor)
                    {
                        playervendorCount++;
                    }

                    Type type = mx.GetType();
                    TownshipNPCAttribute[] attributearray = (TownshipNPCAttribute[])type.GetCustomAttributes(typeof(TownshipNPCAttribute), false);
                    if (attributearray.Length > 0)
                    {
                        tsnpcCount++;

                        //it's a townshipNPC
                        if (TownshipHelper.IsRestrictedTownshipNPC(mx))
                        {
                            bCanPlace = false;
                        }
                    }
                }

                if (
                    (playervendorCount > 0 || tsnpcCount > 0)
                    &&
                    (TownshipHelper.IsRestrictedTownshipNPCDeed(this))
                    )
                {
                    bCanPlace = false;
                }

                if (!bCanPlace)
                {
                    from.SendMessage("You cannot place this vendor in a house with the other vendors that are present.");
                }
                else
                {
                    //now check that the total TownshipNPC count is under what the house can hold.
                    if (house.MaxSecures <= tsnpcCount)
                    {
                        from.SendMessage("You can't have any more Township NPCs in this house");
                    }
                    else
                    {
                        if (this.Place(from))
                        {
                            this.Delete();
                        }
                        else
                        {
                            from.SendMessage("Placement failed");
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public bool TryTransmutate(Mobile from, Item dropped)
        {
            BaseHouse house = BaseHouse.FindHouseAt(from);

            if (house != null && house.IsOwner(from))
            {
                CraftResource res = CraftResources.GetFromType(dropped.GetType());

                if (res == Resource)
                {
                    if (dropped.Amount < 3)
                    {
                        from.SendLocalizedMessage(1152634); // There is not enough to transmute
                    }
                    else if (Charges <= 0)
                    {
                        from.SendLocalizedMessage(1152635); // The cauldron's magic is exhausted
                    }
                    else
                    {
                        CraftResourceInfo info = CraftResources.GetInfo(Resource + 1);

                        if (info != null && info.ResourceTypes.Length > 0)
                        {
                            int           toDrop = Math.Min(Charges * 3, dropped.Amount);
                            CraftResource newRes = (CraftResource)(int)res + 1;

                            while (toDrop % 3 != 0)
                            {
                                toDrop--;
                            }

                            int newAmount = toDrop / 3;

                            if (toDrop < dropped.Amount)
                            {
                                dropped.Amount -= toDrop;
                            }
                            else
                            {
                                dropped.Delete();
                            }

                            Item item = Loot.Construct(info.ResourceTypes[0]);

                            if (item != null)
                            {
                                item.Amount = newAmount;
                                from.AddToBackpack(item);

                                from.SendLocalizedMessage(1152636); // The cauldron transmutes the material

                                from.PlaySound(Utility.RandomList(0x22, 0x23));

                                Charges -= newAmount;
                                Components.ForEach(c => c.InvalidateProperties());

                                return(true);
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1152633); // The cauldron cannot transmute that
                        }
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1152632); // That is not yours!
            }
            return(false);
        }
Ejemplo n.º 10
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_Boat == null || from == null)
            {
                return;
            }

            BaseBoat boat    = BaseBoat.FindBoatAt(from, from.Map);
            int      range   = boat != null && boat == this.Boat ? 3 : 8;
            bool     canMove = false;

            if (m_Boat != null)
            {
                m_Boat.Refresh();
            }

            if (boat != null && m_Boat != boat)
            {
                boat.Refresh();
            }

            if (!from.InRange(this.Location, range))
            {
                from.SendLocalizedMessage(500295); //You are too far away to do that.
            }
            else if (!from.InLOS(this.Location))
            {
                from.SendLocalizedMessage(500950); //You cannot see that.
            }
            else if (m_Boat.IsMoving || m_Boat.IsTurning)
            {
                from.SendLocalizedMessage(1116611); //You can't use that while the ship is moving!
            }
            else if (BaseBoat.IsDriving(from))
            {
                from.SendLocalizedMessage(1116610); //You can't do that while piloting a ship!
            }
            else if (BaseHouse.FindHouseAt(from) != null)
            {
                from.SendLocalizedMessage(1149795); //You may not dock a ship while on another ship or inside a house.
            }
            else if (!m_Boat.IsClassicBoat)
            {
                if (boat == m_Boat && !MoveToNearestDockOrLand(from))
                {
                    from.SendLocalizedMessage(1149796); //You can not dock a ship this far out to sea. You must be near land or shallow water.
                }
                else if (boat == null)
                {
                    if (!from.Alive)
                    {
                        from.SendLocalizedMessage(1060190); //You cannot do that while dead!
                    }
                    else if ((m_Boat is BaseGalleon && ((BaseGalleon)m_Boat).HasAccess(from)) || (m_Boat is RowBoat && ((RowBoat)m_Boat).HasAccess(from)))
                    {
                        canMove = true;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1116617); //You do not have permission to board this ship.
                    }
                }
                else if (boat != null && m_Boat != boat)
                {
                    if (!from.Alive)
                    {
                        from.SendLocalizedMessage(1060190); //You cannot do that while dead!
                    }
                    else if (boat is BaseGalleon && m_Boat is RowBoat && ((RowBoat)m_Boat).HasAccess(from))
                    {
                        canMove = true;
                    }
                    else if (boat is RowBoat && m_Boat is BaseGalleon && ((BaseGalleon)m_Boat).HasAccess(from))
                    {
                        canMove = true;
                    }
                    else if (boat is BaseGalleon && m_Boat is BaseGalleon && ((BaseGalleon)m_Boat).HasAccess(from))
                    {
                        canMove = true;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1149795); //You may not dock a ship while on another ship or inside a house.
                    }
                }
            }

            if (canMove)
            {
                BaseCreature.TeleportPets(from, this.Location, this.Map);
                from.MoveToWorld(this.Location, this.Map);
            }
        }
Ejemplo n.º 11
0
        public void DoubleClick(Mobile from)
        {
            Mobile m_Player = from as PlayerMobile;

            if (m_Player.CantWalk && !m_Sleeping)
            {
                m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You are already sleeping somewhere!");
            }
            else
            {
                if (!m_Sleeping)
                {
                    BaseHouse m_house    = BaseHouse.FindHouseAt(from);
                    BaseHouse this_house = BaseHouse.FindHouseAt(this);
                    if (m_house != null && (m_house != this_house))
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You cannot sleep in someone elses bed! Get a bed of your own.");
                        return;
                    }
                    if (m_house != null && (m_house.IsOwner(from) || m_house.IsCoOwner(from) || m_house.IsFriend(from)))
                    {
                        wtry              = 0;
                        m_Owner           = m_Player;
                        m_Player.Hidden   = true;
                        m_Player.CantWalk = true;
                        m_Sleeping        = true;
                        m_SleeperBedBody  = new SleeperBedBody(m_Player, false, false);
                        Point3D m_Location = new Point3D(this.Location.X + 1, this.Location.Y, this.Location.Z + 6);
                        m_SleeperBedBody.Direction = Direction.East;
                        m_SleeperBedBody.MoveToWorld(m_Location, this.Map);
                    }
                    else
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You must be in the house and be the owner, co-owner or friend of the house this bed is in to sleep in it.");
                        return;
                    }
                }
                else
                {
                    if (m_Owner == m_Player)
                    {
                        m_Sleeping        = false;
                        m_Player.Hidden   = false;
                        m_Player.CantWalk = false;
                        if (m_SleeperBedBody != null)
                        {
                            m_SleeperBedBody.Delete();
                        }
                        m_SleeperBedBody = null;
                        switch (Utility.RandomMinMax(1, 3))
                        {
                        case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You wake up and feel rested and strong.");
                            break;

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You spring out of bed, ready for another day!");
                            break;

                        case 3:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You fall out of bed and blearily reach for the coffee pot.");
                            break;
                        }
                    }
                    else
                    {
                        switch (wtry)
                        {
                        case 0:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "Shhh, don't wake them up. They really need their beauty rest!");
                            wtry = wtry + 1;
                            break;

                        case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You really should NOT bother someone that is sleeping. Bad things might happen.");
                            wtry = wtry + 1;
                            break;

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You were warned!! Now leave them alone.");
                            m_Player.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.Head);
                            m_Player.PlaySound(0x208);
                            m_Player.Hits = m_Player.Hits - 40;
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
            protected override void OnTarget(Mobile src, object targ)
            {
                bool foundAnyone = false;

                Point3D p;

                if (targ is Mobile)
                {
                    p = ((Mobile)targ).Location;
                }
                else if (targ is Item)
                {
                    p = ((Item)targ).Location;
                }
                else if (targ is IPoint3D)
                {
                    p = new Point3D((IPoint3D)targ);
                }
                else
                {
                    p = src.Location;
                }

                double srcSkill = src.Skills[SkillName.DetectHidden].Value;
                int    range    = (int)(srcSkill / 10.0);

                if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                {
                    range /= 2;
                }

                BaseHouse house = BaseHouse.FindHouseAt(p, src.Map, 16);

                bool inHouse = house != null && house.IsFriend(src);

                if (inHouse)
                {
                    range = 22;
                }

                if (range > 0)
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, range);

                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden && src != trg)
                        {
                            double ss         = srcSkill + Utility.Random(21) - 10;
                            double ts         = trg.Skills[SkillName.Hiding].Value + Utility.Random(21) - 10;
                            double shadow     = Server.Spells.SkillMasteries.ShadowSpell.GetDifficultyFactor(trg);
                            bool   houseCheck = inHouse && house.IsInside(trg);

                            if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || houseCheck) && Utility.RandomDouble() > shadow)
                            {
                                if ((trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y)) ||
                                    (!houseCheck && !CanDetect(src, trg)))
                                {
                                    continue;
                                }

                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814); // You have been revealed!
                                foundAnyone = true;
                            }
                        }
                    }

                    inRange.Free();

                    IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range);

                    foreach (Item item in itemsInRange)
                    {
                        if (item.Visible)
                        {
                            continue;
                        }

                        IRevealableItem dItem = item as IRevealableItem;

                        if (dItem != null && dItem.CheckReveal(src))
                        {
                            dItem.OnRevealed(src);

                            foundAnyone = true;
                        }
                    }

                    itemsInRange.Free();
                }

                if (!foundAnyone)
                {
                    src.SendLocalizedMessage(500817); // You can see nothing hidden there.
                }
            }
Ejemplo n.º 13
0
            protected override void OnTarget(Mobile src, object targ)
            {
                bool foundAnything = false;

                double  srcSkill = src.Skills[SkillName.DetectHidden].Value;
                Point3D p;

                if (targ is Mobile)
                {
                    p = ((Mobile)targ).Location;
                }
                else if (targ is Item)
                {
                    p = ((Item)targ).Location;
                }
                else if (targ is IPoint3D)
                {
                    p = new Point3D((IPoint3D)targ);
                }
                else
                {
                    p = src.Location;
                }

                double skillLevel = src.Skills.DetectHidden.Value;

                bool success = src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0);
                int  range   = ((int)Math.Min(100.0, skillLevel)) / 25;

                BaseHouse house   = BaseHouse.FindHouseAt(p, src.Map, 16);
                bool      inHouse = (house != null && house.IsFriend(src));

                if (success || inHouse)
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, inHouse ? 22 : range);
                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden && src != trg)
                        {
                            double ss = srcSkill + Utility.RandomMinMax(-20, 20);
                            double ts = trg.Skills[SkillName.Hiding].Value + Utility.RandomMinMax(-20, 20);
                            if (src.AccessLevel >= trg.AccessLevel && (!inHouse && ss >= ts || inHouse && house.IsInside(trg)))
                            {
                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814); // You have been revealed!
                                foundAnything = true;
                            }
                        }
                    }
                    inRange.Free();



                    inRange = src.Map.GetItemsInRange(p, range);
                    foreach (Item trg in inRange)
                    {
                        if (!(trg is TrapableContainer))
                        {
                            continue;
                        }
                        TrapableContainer cont = (TrapableContainer)trg;
                        if (cont.Visible && cont.Trapped && Utility.RandomDouble() * 100 < skillLevel)
                        {
                            int hue;
                            switch (cont.TrapType)
                            {
                            case TrapType.DartTrap:
                                hue = 123;
                                break;

                            case TrapType.ExplosionTrap:
                            case TrapType.MagicTrap:
                                hue = 0x7D;
                                break;

                            case TrapType.PoisonTrap:
                                hue = 90;
                                break;

                            default:
                                hue = 0x3B2;
                                break;
                            }
                            src.Send(new Server.Network.MessageLocalized(cont.Serial, cont.ItemID, Server.Network.MessageType.Regular, hue, 3, 500813, "", "")); // [trapped]
                            foundAnything = true;
                        }
                    }
                    inRange.Free();
                }

                if (!foundAnything)
                {
                    src.SendLocalizedMessage(500817); // You can see nothing hidden there.
                }
            }
Ejemplo n.º 14
0
        protected override void AcceptOffer(Mobile from)
        {
            m_Contract.Offeree = null;

            if (!m_Contract.Map.CanFit(m_Contract.Location, 16, false, false))
            {
                m_Landlord.SendLocalizedMessage(1062486);                 // A vendor cannot exist at that location.  Please try again.
                return;
            }

            BaseHouse house = BaseHouse.FindHouseAt(m_Contract);

            if (house == null)
            {
                return;
            }

            int price = m_Contract.Price;
            int currencyToGive;

            if (price > 0)
            {
                Type cType = m_Contract.Expansion == Expansion.T2A ? typeof(Silver) : typeof(Gold);

                if (Banker.Withdraw(from, cType, price))
                {
                    from.SendMessage("{0:#,0} {1} has been withdrawn from your bank box.", price, cType.Name);

                    int depositedCurrency = Banker.DepositUpTo(m_Landlord, cType, price);
                    currencyToGive = price - depositedCurrency;

                    if (depositedCurrency > 0)
                    {
                        m_Landlord.SendMessage("{0:#,0} {1} has been deposited into your bank box.", price, cType.Name);
                    }

                    if (currencyToGive > 0)
                    {
                        m_Landlord.SendLocalizedMessage(500390);                         // Your bank box is full.
                    }
                }
                else
                {
                    from.SendMessage("You do not have enough {0} in your bank account to cover the cost of the contract.", cType.Name);

                    m_Landlord.SendLocalizedMessage(1062374, from.Name);                     // ~1_NAME~ has declined your vendor rental offer.

                    return;
                }
            }
            else
            {
                currencyToGive = 0;
            }

            PlayerVendor vendor = new RentedVendor(
                from, house, m_Contract.Duration, price, m_Contract.LandlordRenew, currencyToGive);

            vendor.MoveToWorld(m_Contract.Location, m_Contract.Map);

            m_Contract.Delete();

            // You have accepted the offer and now own a vendor in this house.  Rental contract options and details may be viewed on this vendor via the 'Contract Options' context menu.
            from.SendLocalizedMessage(1062377);

            // ~1_NAME~ has accepted your vendor rental offer.  Rental contract details and options may be viewed on this vendor via the 'Contract Options' context menu.
            m_Landlord.SendLocalizedMessage(1062376, from.Name);
        }
Ejemplo n.º 15
0
        public virtual bool ValidateUse(Mobile m, bool message)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house == null || !IsLockedDown)
            {
                if (message)
                {
                    m.SendMessage("This must be locked down in a house to use!");
                }

                return(false);
            }

            if (!house.HasSecureAccess(m, m_Level))
            {
                if (message)
                {
                    m.SendLocalizedMessage(503301, "", 0x22); // You don't have permission to do that.
                }

                return(false);
            }

            if (Engines.VvV.VvVSigil.ExistsOn(m))
            {
                if (message)
                {
                    m.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
                }

                return(false);
            }

            if (WeightOverloading.IsOverloaded(m))
            {
                if (message)
                {
                    m.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
                }

                return(false);
            }

            if (m.Criminal)
            {
                if (message)
                {
                    m.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
                }

                return(false);
            }

            if (SpellHelper.CheckCombat(m))
            {
                if (message)
                {
                    m.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
                }

                return(false);
            }

            if (m.Spell != null)
            {
                if (message)
                {
                    m.SendLocalizedMessage(1049616); // You are too busy to do that at the moment.
                }

                return(false);
            }

            if (Engines.CityLoyalty.CityTradeSystem.HasTrade(m))
            {
                if (message)
                {
                    m.SendLocalizedMessage(1151733); // You cannot do that while carrying a Trade Order.
                }

                return(false);
            }

            return(true);
        }
Ejemplo n.º 16
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Head == null || m_Head.Deleted)
                {
                    return;
                }

                if (m_Head.IsChildOf(from.Backpack))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);

                    if (house != null && house.IsOwner(from))
                    {
                        IPoint3D p   = targeted as IPoint3D;
                        Map      map = from.Map;

                        if (p == null || map == null)
                        {
                            return;
                        }

                        Point3D  p3d = new Point3D(p);
                        ItemData id  = TileData.ItemTable[0x10F5];

                        house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                        if (house != null && house.IsOwner(from))
                        {
                            if (map.CanFit(p3d, id.Height))
                            {
                                bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                bool west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                FlamingHead head = null;

                                if (north && west)
                                {
                                    head = new FlamingHead(StoneFaceTrapType.NorthWestWall);
                                }
                                else if (north)
                                {
                                    head = new FlamingHead(StoneFaceTrapType.NorthWall);
                                }
                                else if (west)
                                {
                                    head = new FlamingHead(StoneFaceTrapType.WestWall);
                                }

                                if (north || west)
                                {
                                    house.Addons.Add(head);

                                    head.IsRewardItem = m_Head.IsRewardItem;
                                    head.MoveToWorld(p3d, map);

                                    m_Head.Delete();
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1042266);                                       // The head must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042266);                                   // The head must be placed next to a wall.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042036);                               // That location is not in your house.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502115);                           // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038);                       // You must have the object in your backpack to use it.
                }
            }
Ejemplo n.º 17
0
        public bool CheckAccess(Mobile m)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            return(house != null && house.HasSecureAccess(m, m_Level));
        }
        public override bool IsUsableBy(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            return(house != null && house.IsCoOwner(from) && IsAccessibleTo(from));
        }
Ejemplo n.º 19
0
        protected override void AcceptOffer(Mobile from)
        {
            m_Contract.Offeree = null;

            if (!m_Contract.Map.CanFit(m_Contract.Location, 16, false, false))
            {
                m_Landlord.SendLocalizedMessage(1062486); // A vendor cannot exist at that location.  Please try again.
                return;
            }

            BaseHouse house = BaseHouse.FindHouseAt(m_Contract);

            if (house == null)
            {
                return;
            }

            int price = m_Contract.Price;
            int goldToGive;

            if (price > 0)
            {
                if (Banker.Withdraw(from, price))
                {
                    from.SendLocalizedMessage(1060398, price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.

                    int depositedGold = Banker.DepositUpTo(m_Landlord, price);
                    goldToGive = price - depositedGold;

                    if (depositedGold > 0)
                    {
                        m_Landlord.SendLocalizedMessage(1060397, price.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box.
                    }
                    if (goldToGive > 0)
                    {
                        m_Landlord.SendLocalizedMessage(500390); // Your bank box is full.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1062378);                  // You do not have enough gold in your bank account to cover the cost of the contract.
                    m_Landlord.SendLocalizedMessage(1062374, from.Name); // ~1_NAME~ has declined your vendor rental offer.

                    return;
                }
            }
            else
            {
                goldToGive = 0;
            }

            PlayerVendor vendor = new RentedVendor(from, house, m_Contract.Duration, price, m_Contract.LandlordRenew, goldToGive);

            vendor.MoveToWorld(m_Contract.Location, m_Contract.Map);

            m_Contract.Delete();

            from.SendLocalizedMessage(1062377);                  // You have accepted the offer and now own a vendor in this house.  Rental contract options and details may be viewed on this vendor via the 'Contract Options' context menu.
            m_Landlord.SendLocalizedMessage(1062376, from.Name); // ~1_NAME~ has accepted your vendor rental offer.  Rental contract details and options may be viewed on this vendor via the 'Contract Options' context menu.

            EventSink.InvokePlacePlayerVendor(new PlacePlayerVendorEventArgs(from, vendor));
        }
Ejemplo n.º 20
0
        public static bool NearDock(Mobile m)
        {
            bool IsNearDock = false;

            int DockRange     = 30;
            int KeepSearching = 0;

            Region reg = Region.Find(m.Location, m.Map);

            if (reg.IsPartOf("the Island of Poseidon"))
            {
                IsNearDock = true;
            }
            else if (reg.IsPartOf("the Buccaneer's Den"))
            {
                IsNearDock = true;
            }
            else if (Server.Misc.Worlds.GetRegionName(m.Map, m.Location) == "the Underworld")
            {
                IsNearDock = true;
            }
            else if (m.Skills[SkillName.Fishing].Base >= 100)               // GM FISHERMAN CAN DOCK AND LAUNCH ANYWHERE
            {
                IsNearDock = true;
            }
            else if (reg.IsPartOf("the Island of the Black Knight"))
            {
                IsNearDock = true;
            }
            else if (reg.IsPartOf("the Island of Stonegate"))
            {
                IsNearDock = true;
            }
            else
            {
                foreach (Item lantern in m.GetItemsInRange(DockRange))
                {
                    if (KeepSearching != 1)
                    {
                        if (lantern is DockingLantern)
                        {
                            IsNearDock = true;
                            DockingLantern light = (DockingLantern)lantern;
                            BaseHouse      house = BaseHouse.FindHouseAt(lantern);
                            if (lantern.Movable != false)
                            {
                                IsNearDock = false;
                            }
                            if (house != null && (house.Public ? house.IsBanned(m) : !house.HasAccess(m)))
                            {
                                IsNearDock = false;
                            }
                            if (house != null && !house.HasSecureAccess(m, light.m_Level))
                            {
                                IsNearDock = false;
                            }
                            if (IsNearDock == true)
                            {
                                KeepSearching = 1;
                            }
                        }
                    }
                }
            }

            return(IsNearDock);
        }
Ejemplo n.º 21
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                from.SendLocalizedMessage(503248); // Your godly powers allow you to place this vendor whereever you wish.

                Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from))
                {
                    Direction = from.Direction & Direction.Mask
                };
                v.MoveToWorld(from.Location, from.Map);

                v.SayTo(from, 503246); // Ah! it feels good to be working again.

                EventSink.InvokePlacePlayerVendor(new PlacePlayerVendorEventArgs(from, v));

                Delete();
            }
            else
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house == null)
                {
                    from.SendLocalizedMessage(503240); // Vendors can only be placed in houses.
                }
                else if (!BaseHouse.NewVendorSystem && !house.IsFriend(from))
                {
                    from.SendLocalizedMessage(503242); // You must ask the owner of this building to name you a friend of the household in order to place a vendor here.
                }
                else if (BaseHouse.NewVendorSystem && !house.IsOwner(from))
                {
                    from.SendLocalizedMessage(1062423); // Only the house owner can directly place vendors.  Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house.
                }
                else if (!house.Public || !house.CanPlaceNewVendor())
                {
                    from.SendLocalizedMessage(503241); // You cannot place this vendor or barkeep.  Make sure the house is public and has sufficient storage available.
                }
                else
                {
                    BaseHouse.IsThereVendor(from.Location, from.Map, out bool vendor, out bool contract);

                    if (vendor)
                    {
                        from.SendLocalizedMessage(1062677); // You cannot place a vendor or barkeep at this location.
                    }
                    else if (contract)
                    {
                        from.SendLocalizedMessage(1062678); // You cannot place a vendor or barkeep on top of a rental contract!
                    }
                    else
                    {
                        Mobile v = new PlayerVendor(from, house)
                        {
                            Direction = from.Direction & Direction.Mask
                        };
                        v.MoveToWorld(from.Location, from.Map);

                        v.SayTo(from, 503246); // Ah! it feels good to be working again.

                        EventSink.InvokePlacePlayerVendor(new PlacePlayerVendorEventArgs(from, v));

                        Delete();
                    }
                }
            }
        }
        public void DoubleClick(Mobile from)
        {
            Mobile m_Player = from as PlayerMobile;

            if (!m_Player.CanSee(this) || !m_Player.InLOS(this))
            {
                m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You are too far from the bed!");
                return;
            }

            if (m_Player.CantWalk && !m_Sleeping)
            {
                m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You are already sleeping somewhere!");
            }
            else
            {
                if (!m_Sleeping)
                {
                    BaseHouse m_house    = BaseHouse.FindHouseAt(from);
                    BaseHouse this_house = BaseHouse.FindHouseAt(this);
                    if (m_house != null && (m_house != this_house))
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You cannot sleep in someone elses bed! Get a bed of your own.");
                        return;
                    }
                    if (m_house != null && (m_house.IsOwner(from) || m_house.IsCoOwner(from) || m_house.IsFriend(from)))
                    {
                        m_Owner = m_Player;

                        m_Player.Hidden    = true;
                        m_Player.Squelched = true;
                        m_Player.Frozen    = true;
                        m_wakeup           = 0;
                        m_Player.CantWalk  = true;
                        m_Sleeping         = true;
                        m_Player.Blessed   = true;

                        m_SleepingBodies = new SleepingBodies(m_Player, false, false);

                        #region Sleeping Body Position

                        Point3D m_Location = new Point3D(this.Location.X + 2, this.Location.Y, this.Location.Z + 10);

                        #endregion

                        m_SleepingBodies.Direction = Direction.East;
                        m_SleepingBodies.MoveToWorld(m_Location, this.Map);
                    }
                    else
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You must be the owner, co-owner or friend of this house this bed is in to sleep in it.");
                        return;
                    }
                }
                else
                {
                    if (m_Owner == m_Player)
                    {
                        m_Player.Hidden    = false;
                        m_Player.Squelched = false;
                        m_Player.Frozen    = false;
                        m_wakeup           = 0;
                        m_Player.CantWalk  = false;
                        m_Sleeping         = false;
                        m_Player.Blessed   = false;

                        if (m_SleepingBodies != null)
                        {
                            m_SleepingBodies.Delete();
                        }
                        m_SleepingBodies = null;

                        switch (Utility.RandomMinMax(1, 3))
                        {
                        case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You wake up and feel strong and well rested.");
                            break;

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You spring out of bed, ready for another day!");
                            break;

                        case 3:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You fall out of bed and crack your knee on the wooden bedframe!");
                            m_Player.Hits = m_Player.Hits - 25;
                            break;
                        }
                    }
                    else
                    {
                        switch (m_wakeup)
                        {
                        case 0:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "Shhh, don't wake them up. They really need their beauty rest!");
                            m_wakeup = m_wakeup + 1;
                            break;

                        case 1:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You really should NOT bother someone that is sleeping. Bad things might happen.");
                            m_wakeup = m_wakeup + 1;
                            break;

                        case 2:
                            m_Player.LocalOverheadMessage(MessageType.Regular, 0x33, true, "You were warned!! Now leave them alone.");
                            m_Player.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.Head);
                            m_Player.PlaySound(0x208);
                            m_Player.Hits = m_Player.Hits - 40;
                            break;
                        }
                    }
                }
            }
        }
 private void UpgradeFromVersion0()
 {
     House = BaseHouse.FindHouseAt(this);
 }
Ejemplo n.º 24
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!m_Contract.IsUsableBy(from, false, true, true, true))
                {
                    return;
                }

                IPoint3D location = targeted as IPoint3D;

                if (location == null)
                {
                    return;
                }

                Point3D pLocation = new Point3D(location);
                Map     map       = from.Map;

                BaseHouse house = BaseHouse.FindHouseAt(pLocation, map, 0);

                if (house == null || !house.IsOwner(from))
                {
                    from.SendLocalizedMessage(1062338);                       // The location being rented out must be inside of your house.
                }
                else if (BaseHouse.FindHouseAt(from) != house)
                {
                    from.SendLocalizedMessage(1062339);                       // You must be located inside of the house in which you are trying to place the contract.
                }
                else if (!house.IsAosRules)
                {
                    from.SendMessage("Rental contracts can only be placed in AOS-enabled houses.");
                }
                else if (!house.Public)
                {
                    from.SendLocalizedMessage(1062335);                       // Rental contracts can only be placed in public houses.
                }
                else if (house.DecayType == DecayType.Condemned)
                {
                    from.SendLocalizedMessage(1062468);                       // You cannot place a contract in a condemned house.
                }
                else if (!house.CanPlaceNewVendor())
                {
                    from.SendLocalizedMessage(1062352);                       // You do not have enought storage available to place this contract.
                }
                else if (!map.CanFit(pLocation, 16, false, false))
                {
                    from.SendLocalizedMessage(1062486);                       // A vendor cannot exist at that location.  Please try again.
                }
                else
                {
                    bool vendor, contract;
                    BaseHouse.IsThereVendor(pLocation, map, out vendor, out contract);

                    if (vendor)
                    {
                        from.SendLocalizedMessage(1062342);                           // You may not place a rental contract at this location while other beings occupy it.
                    }
                    else if (contract)
                    {
                        from.SendLocalizedMessage(1062341);                           // That location is cluttered.  Please clear out any objects there and try again.
                    }
                    else
                    {
                        m_Contract.MoveToWorld(pLocation, map);

                        if (!house.LockDown(from, m_Contract))
                        {
                            from.AddToBackpack(m_Contract);
                        }
                    }
                }
            }
Ejemplo n.º 25
0
        public void Mark(Mobile m)
        {
            m_Marked = true;

            bool setDesc = false;

            if (Core.AOS)
            {
                m_House = BaseHouse.FindHouseAt(m);

                if (m_House == null)
                {
                    m_Target    = m.Location;
                    m_TargetMap = m.Map;
                }
                else
                {
                    HouseSign sign = m_House.Sign;

                    if (sign != null)
                    {
                        m_Description = sign.Name;
                    }
                    else
                    {
                        m_Description = null;
                    }

                    if (m_Description == null || (m_Description = m_Description.Trim()).Length == 0)
                    {
                        m_Description = "an unnamed house";
                    }

                    setDesc = true;

                    int x = m_House.BanLocation.X;
                    int y = m_House.BanLocation.Y + 2;
                    int z = m_House.BanLocation.Z;

                    Map map = m_House.Map;

                    if (map != null && !map.CanFit(x, y, z, 16, false, false))
                    {
                        z = map.GetAverageZ(x, y);
                    }

                    m_Target    = new Point3D(x, y, z);
                    m_TargetMap = map;
                }
            }
            else
            {
                m_House     = null;
                m_Target    = m.Location;
                m_TargetMap = m.Map;
            }

            if (!setDesc)
            {
                m_Description = BaseRegion.GetRuneNameFor(Region.Find(m_Target, m_TargetMap));
            }

            CalculateHue();
            InvalidateProperties();
        }
Ejemplo n.º 26
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Shield == null || m_Shield.Deleted)
                {
                    return;
                }

                if (m_Shield.IsChildOf(from.Backpack))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);

                    if (house != null && house.IsOwner(from))
                    {
                        IPoint3D p   = targeted as IPoint3D;
                        Map      map = from.Map;

                        if (p == null || map == null)
                        {
                            return;
                        }

                        Point3D  p3d = new Point3D(p);
                        ItemData id  = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];

                        if (map.CanFit(p3d, id.Height))
                        {
                            house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                            if (house != null && house.IsOwner(from))
                            {
                                bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                bool west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                if (north && west)
                                {
                                    from.CloseGump(typeof(FacingGump));
                                    from.SendGump(new FacingGump(m_Shield, m_ItemID, p3d, house));
                                }
                                else if (north || west)
                                {
                                    DecorativeShield shield = null;

                                    if (north)
                                    {
                                        shield = new DecorativeShield(m_ItemID);
                                    }
                                    else if (west)
                                    {
                                        shield = new DecorativeShield(GetWestItemID(m_ItemID));
                                    }

                                    house.Addons[shield] = from;

                                    shield.IsRewardItem = m_Shield.IsRewardItem;
                                    shield.MoveToWorld(p3d, map);

                                    m_Shield.Delete();
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1049781); // This decoration must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042036); // That location is not in your house.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500269); // You cannot build that there.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502092); // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
                }
            }
Ejemplo n.º 27
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Decorator.Command == DecorateCommand.GetHue)
                {
                    int hue = 0;

                    if (targeted is Item)
                    {
                        hue = ((Item)targeted).Hue;
                    }
                    else if (targeted is Mobile)
                    {
                        hue = ((Mobile)targeted).Hue;
                    }
                    else
                    {
                        from.Target = new InternalTarget(m_Decorator);
                        return;
                    }

                    from.SendLocalizedMessage(1158862, String.Format("{0}", hue)); // That object is hue ~1_HUE~
                }
                else if (targeted is Item && CheckUse(m_Decorator, from))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);
                    Item      item  = (Item)targeted;

                    bool isDecorableComponent = false;

                    if (m_Decorator.Command == DecorateCommand.Turn && IsKingsCollection(item))
                    {
                        isDecorableComponent = true;
                    }
                    else if (item is AddonComponent || item is AddonContainerComponent || item is BaseAddonContainer)
                    {
                        object addon = null;
                        int    count = 0;

                        if (item is AddonComponent)
                        {
                            AddonComponent component = (AddonComponent)item;
                            count = component.Addon.Components.Count;
                            addon = component.Addon;
                        }
                        else if (item is AddonContainerComponent)
                        {
                            AddonContainerComponent component = (AddonContainerComponent)item;
                            count = component.Addon.Components.Count;
                            addon = component.Addon;
                        }
                        else if (item is BaseAddonContainer)
                        {
                            BaseAddonContainer container = (BaseAddonContainer)item;
                            count = container.Components.Count;
                            addon = container;
                        }

                        if (count == 1)
                        {
                            isDecorableComponent = true;
                        }

                        if (item is EnormousVenusFlytrapAddon)
                        {
                            isDecorableComponent = true;
                        }

                        if (m_Decorator.Command == DecorateCommand.Turn)
                        {
                            FlipableAddonAttribute[] attributes = (FlipableAddonAttribute[])addon.GetType().GetCustomAttributes(typeof(FlipableAddonAttribute), false);

                            if (attributes.Length > 0)
                            {
                                isDecorableComponent = true;
                            }
                        }
                    }
                    else if (item is Banner && m_Decorator.Command != DecorateCommand.Turn)
                    {
                        isDecorableComponent = true;
                    }

                    if (house == null || !house.IsCoOwner(from))
                    {
                        from.SendLocalizedMessage(502092); // You must be in your house to do
                    }
                    else if (item.Parent != null || !house.IsInside(item))
                    {
                        from.SendLocalizedMessage(1042270); // That is not in your house.
                    }
                    else if (!house.IsLockedDown(item) && !house.IsSecure(item) && !isDecorableComponent)
                    {
                        if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Turn)
                        {
                            from.SendLocalizedMessage(1042273); // You cannot turn that.
                        }
                        else if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Up)
                        {
                            from.SendLocalizedMessage(1042274); // You cannot raise it up any higher.
                        }
                        else if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Down)
                        {
                            from.SendLocalizedMessage(1042275); // You cannot lower it down any further.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042271); // That is not locked down.
                        }
                    }
                    else if (item is VendorRentalContract)
                    {
                        from.SendLocalizedMessage(1062491); // You cannot use the house decorator on that object.
                    }

                    /*else if (item.TotalWeight + item.PileWeight > 100)
                     * {
                     *  from.SendLocalizedMessage(1042272); // That is too heavy.
                     * }*/
                    else
                    {
                        switch (m_Decorator.Command)
                        {
                        case DecorateCommand.Up:
                            Up(item, from);
                            break;

                        case DecorateCommand.Down:
                            Down(item, from);
                            break;

                        case DecorateCommand.Turn:
                            Turn(item, from);
                            break;
                        }
                    }
                }

                from.Target = new InternalTarget(m_Decorator);
            }
Ejemplo n.º 28
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            PageType type = (PageType)(-1);

            switch (info.ButtonID)
            {
            case 0:                                          // Close/Cancel
            {
                from.SendLocalizedMessage(501235, "", 0x35); // Help request aborted.

                break;
            }

            case 1:                     // General question
            {
                type = PageType.Question;
                break;
            }

            case 2:                     // Stuck
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house != null && house.IsAosRules)
                {
                    from.Location = house.BanLocation;
                }
                else if (from.Region.IsPartOf(typeof(Server.Regions.Jail)))
                {
                    from.SendLocalizedMessage(1041530, "", 0x35);                               // You'll need a better jailbreak plan then that!
                }
                else if (Factions.Sigil.ExistsOn(from))
                {
                    from.SendLocalizedMessage(1061632);                               // You can't do that while carrying the sigil.
                }
                else if (from.CanUseStuckMenu() && from.Region.CanUseStuckMenu(from) && !CheckCombat(from) && !from.Frozen && !from.Criminal && (Core.AOS || from.Kills < 5))
                {
                    StuckMenu menu = new StuckMenu(from, from, true);

                    menu.BeginClose();

                    from.SendGump(menu);
                }
                else
                {
                    type = PageType.Stuck;
                }

                break;
            }

            case 3:                     // Report bug or contact Origin
            {
                type = PageType.Bug;
                break;
            }

            case 4:                     // Game suggestion
            {
                type = PageType.Suggestion;
                break;
            }

            case 5:                     // Account management
            {
                type = PageType.Account;
                break;
            }

            case 6:                     // Other
            {
                type = PageType.Other;
                break;
            }

            case 7:                     // Harassment: verbal/exploit
            {
                type = PageType.VerbalHarassment;
                break;
            }

            case 8:                     // Harassment: physical
            {
                type = PageType.PhysicalHarassment;
                break;
            }

            case 9:                     // Young player transport
            {
                if (IsYoung(from))
                {
                    if (from.Region.IsPartOf(typeof(Regions.Jail)))
                    {
                        from.SendLocalizedMessage(1041530, "", 0x35);                                   // You'll need a better jailbreak plan then that!
                    }
                    else if (from.Region.IsPartOf("Haven Island"))
                    {
                        from.SendLocalizedMessage(1041529);                                   // You're already in Haven
                    }
                    else
                    {
                        from.MoveToWorld(new Point3D(3503, 2574, 14), Map.Trammel);
                    }
                }

                break;
            }
            }

            if (type != (PageType)(-1) && PageQueue.CheckAllowedToPage(from))
            {
                from.SendGump(new PagePromptGump(from, type));
            }
        }
Ejemplo n.º 29
0
        public static TimeSpan OnUse(Mobile m)
        {
            if (m.Spell != null)
            {
                m.SendLocalizedMessage(501238); // You are busy doing something else and cannot hide.
                return(TimeSpan.FromSeconds(1.0));
            }

            if (Server.Engines.VvV.ManaSpike.UnderEffects(m))
            {
                return(TimeSpan.FromSeconds(1.0));
            }

            if (Core.ML && m.Target != null)
            {
                Targeting.Target.Cancel(m);
            }

            double bonus = 0.0;

            BaseHouse house = BaseHouse.FindHouseAt(m);

            if (house != null && house.IsFriend(m))
            {
                bonus = 100.0;
            }
            else if (!Core.AOS)
            {
                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X - 1, m.Y, 127), m.Map, 16);
                }

                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X + 1, m.Y, 127), m.Map, 16);
                }

                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y - 1, 127), m.Map, 16);
                }

                if (house == null)
                {
                    house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y + 1, 127), m.Map, 16);
                }

                if (house != null)
                {
                    bonus = 50.0;
                }
            }

            //int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10);
            int skill = Math.Min(100, (int)m.Skills[SkillName.Hiding].Value);
            int range = Math.Min((int)((100 - skill) / 2) + 8, 18);     //Cap of 18 not OSI-exact, intentional difference

            bool badCombat = (!m_CombatOverride && m.Combatant is Mobile && m.InRange(m.Combatant.Location, range) && ((Mobile)m.Combatant).InLOS(m.Combatant));
            bool ok        = (!badCombat /*&& m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus )*/);

            if (ok)
            {
                if (!m_CombatOverride)
                {
                    IPooledEnumerable eable = m.GetMobilesInRange(range);

                    foreach (Mobile check in eable)
                    {
                        if (check.InLOS(m) && check.Combatant == m)
                        {
                            badCombat = true;
                            ok        = false;
                            break;
                        }
                    }

                    eable.Free();
                }

                ok = (!badCombat && m.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus));
            }

            if (badCombat)
            {
                m.RevealingAction();

                m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237); // You can't seem to hide right now.

                return(TimeSpan.Zero);
                //return TimeSpan.FromSeconds(1.0);
            }
            else
            {
                if (ok)
                {
                    m.Hidden  = true;
                    m.Warmode = false;
                    Server.Spells.Sixth.InvisibilitySpell.RemoveTimer(m);
                    Server.Items.InvisibilityPotion.RemoveTimer(m);
                    m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240); // You have hidden yourself well.
                }
                else
                {
                    m.RevealingAction();

                    m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241); // You can't seem to hide here.
                }

                return(TimeSpan.FromSeconds(10.0));
            }
        }
Ejemplo n.º 30
0
        public bool CanUse(Mobile from)
        {
            if (from == null)
            {
                return(false);
            }

            if (from.AccessLevel > AccessLevel.Player)
            {
                return(true);
            }

            if (!from.Alive)
            {
                return(false);
            }

            if (IsChildOf(from.Backpack) || IsChildOf(from.BankBox))
            {
                return(true);
            }

            if (from.Map != Map || !from.InRange(GetWorldLocation(), 2))
            {
                from.SendMessage("That is too far away to use.");
                return(false);
            }

            if (!from.InLOS(this))
            {
                from.SendMessage("That item is out of your line of sight.");
                return(false);
            }

            if (IsLockedDown)
            {
                BaseHouse house = BaseHouse.FindHouseAt(Location, Map, 64);

                if (house == null)
                {
                    from.SendMessage("That is not accessible.");
                    return(false);
                }

                switch (m_LockedDownAccessLevel)
                {
                case LockedDownAccessLevelType.Owner:
                    if (house.Owner != null)
                    {
                        Account ownerAccount  = house.Owner.Account as Account;
                        Account playerAccount = from.Account as Account;

                        if (ownerAccount != null && playerAccount != null && ownerAccount == playerAccount)
                        {
                            return(true);
                        }

                        else
                        {
                            from.SendMessage("You do not have the neccessary access rights to use that.");
                            return(false);
                        }
                    }
                    break;

                case LockedDownAccessLevelType.CoOwner:
                    if (house.IsCoOwner(from))
                    {
                        return(true);
                    }
                    else
                    {
                        from.SendMessage("You do not have the neccessary access rights to use that.");
                        return(false);
                    }
                    break;

                case LockedDownAccessLevelType.Friend:
                    if (house.IsFriend(from))
                    {
                        return(true);
                    }

                    else
                    {
                        from.SendMessage("You do not have the neccessary access rights to use that.");
                        return(false);
                    }

                    break;

                case LockedDownAccessLevelType.Anyone:
                    return(true);

                    break;
                }
            }

            if (RootParent is PlayerMobile && RootParent != from)
            {
                from.SendMessage("That is not accessible.");
                return(false);
            }

            return(true);
        }