Exemplo n.º 1
0
        public static Item Create(Mobile m, CraftItem craftItem, ITool tool)
        {
            DoorType type = DoorType.StoneDoor_S_In;

            if (craftItem.Data is DoorType)
            {
                type = (DoorType)craftItem.Data;
            }

            return(new CraftableStoneHouseDoor(type, CraftableMetalHouseDoor.GetDoorFacing(type)));
        }
Exemplo n.º 2
0
        public void Replace()
        {
            BaseDoor door;

            if (Type < DoorType.LeftMetalDoor_S_In)
            {
                door = new CraftableStoneHouseDoor(Type, CraftableMetalHouseDoor.GetDoorFacing(Type));
            }
            else
            {
                door = new CraftableMetalHouseDoor(Type, CraftableMetalHouseDoor.GetDoorFacing(Type));
            }

            if (door is IResource)
            {
                ((IResource)door).Resource = _Resource;
            }

            if (Parent is Container)
            {
                ((Container)Parent).DropItem(door);
            }
            else
            {
                BaseHouse house = BaseHouse.FindHouseAt(this);

                door.MoveToWorld(Location, Map);

                door.IsLockedDown = IsLockedDown;
                door.IsSecure     = IsSecure;
                door.Movable      = Movable;

                if (house != null && house.LockDowns.ContainsKey(this))
                {
                    house.LockDowns.Remove(this);
                    house.LockDowns.Add(door, house.Owner);
                }
                else if (house != null && house.IsSecure(this))
                {
                    house.ReleaseSecure(house.Owner, this);
                    house.AddSecure(house.Owner, door);
                }
            }

            Delete();
        }
Exemplo n.º 3
0
        public virtual void OnFlip(Mobile from)
        {
            if (Open)
            {
                from.SendMessage("The door must be closed before you can do that.");
                return; // TODO: Message?
            }

            switch (Type)
            {
            default:
            case DoorType.StoneDoor_S_In:
                Type = DoorType.StoneDoor_S_Out;
                break;

            case DoorType.StoneDoor_S_Out:
                Type = DoorType.StoneDoor_S_In;
                break;

            case DoorType.StoneDoor_E_In:
                Type = DoorType.StoneDoor_E_Out;
                break;

            case DoorType.StoneDoor_E_Out:
                Type = DoorType.StoneDoor_E_In;
                break;

            case DoorType.LeftMetalDoor_S_In:
                Type = DoorType.LeftMetalDoor_S_Out;
                break;

            case DoorType.RightMetalDoor_S_In:
                Type = DoorType.RightMetalDoor_S_Out;
                break;

            case DoorType.LeftMetalDoor_E_In:
                Type = DoorType.LeftMetalDoor_E_Out;
                break;

            case DoorType.RightMetalDoor_E_In:
                Type = DoorType.RightMetalDoor_E_Out;
                break;

            case DoorType.LeftMetalDoor_S_Out:
                Type = DoorType.RightMetalDoor_E_Out;
                break;

            case DoorType.RightMetalDoor_S_Out:
                Type = DoorType.RightMetalDoor_S_In;
                break;

            case DoorType.LeftMetalDoor_E_Out:
                Type = DoorType.LeftMetalDoor_E_In;
                break;

            case DoorType.RightMetalDoor_E_Out:
                Type = DoorType.RightMetalDoor_E_In;
                break;
            }

            Facing = CraftableMetalHouseDoor.GetDoorFacing(Type);

            ClosedID = 0x324 + (2 * (int)Facing);
            OpenedID = 0x325 + (2 * (int)Facing);

            Offset = GetOffset(Facing);
            InvalidateProperties();
        }
Exemplo n.º 4
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                from.BeginTarget(10, true, Server.Targeting.TargetFlags.None, (m, targeted) =>
                {
                    if (IsChildOf(from.Backpack))
                    {
                        IPoint3D p = targeted as IPoint3D;
                        Map map    = from.Map;

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

                        Server.Spells.SpellHelper.GetSurfaceTop(ref p);

                        BaseHouse house = null;
                        Item door;

                        if (this.Type < DoorType.LeftMetalDoor_S_In)
                        {
                            door = new CraftableStoneHouseDoor(this.Type, GetDoorFacing(this.Type));
                        }
                        else
                        {
                            door = new CraftableMetalHouseDoor(this.Type, GetDoorFacing(this.Type));
                        }

                        if (door is CraftableMetalHouseDoor)
                        {
                            ((CraftableMetalHouseDoor)door).Resource = _Resource;
                        }
                        else if (door is CraftableStoneHouseDoor)
                        {
                            ((CraftableStoneHouseDoor)door).Resource = _Resource;
                        }

                        AddonFitResult res = CouldFit(door, p, map, from, ref house);

                        switch (res)
                        {
                        case AddonFitResult.Valid:
                            PlaceDoor(door, p, map, house);
                            return;

                        case AddonFitResult.Blocked:
                            from.SendLocalizedMessage(500269);     // You cannot build that there.
                            break;

                        case AddonFitResult.NotInHouse:
                            from.SendLocalizedMessage(500274);     // You can only place this in a house that you own!
                            break;

                        case AddonFitResult.DoorsNotClosed:
                            from.SendMessage("You must close all house doors before placing this.");
                            break;

                        case AddonFitResult.DoorTooClose:
                            from.SendLocalizedMessage(500271);     // You cannot build near the door.
                            break;

                        case AddonFitResult.BadHouse:
                            from.SendLocalizedMessage(500269);     // You cannot build that there.
                            break;
                        }

                        door.Delete();
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                    }
                });
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }