예제 #1
0
 public MapPictureBox() {
     mapImage = null;
     mapCoordinate = null;
     beginCoordinate = null;
     sourceWidth = 0;
     beginWidth = 0;
     targets = new List<Target>();
     paths = new List<TibiaPath>();
     map = null;
     otherMap = null;
 }
예제 #2
0
 public MapPictureBox()
 {
     mapImage = null;
     mapCoordinate = null;
     beginCoordinate = null;
     sourceWidth = 0;
     beginWidth = 0;
     targets = new List<Target>();
     paths = new List<TibiaPath>();
     map = null;
     otherMap = null;
     refreshTimer = new SafeTimer(50, RefreshMapTimer);
 }
예제 #3
0
 protected override void Dispose(bool disposing)
 {
     if (mapImage != null) {
         mapImage.Dispose();
         mapImage = null;
     }
     if (map != null) {
         map.Dispose();
     }
     if (otherMap != null) {
         otherMap.Dispose();
         otherMap = null;
     }
     base.Dispose(disposing);
 }
예제 #4
0
        public void UpdateMap(bool periodicUpdate = false)
        {
            lock (mapBoxLock) {
                int PlayerX = 0, PlayerY = 0, PlayerZ = 0;
                bool recomputeRoute = true;

                if (targetCoordinate != null) {
                    MemoryReader.UpdateBattleList();
                    PlayerX = MemoryReader.X;
                    PlayerY = MemoryReader.Y;
                    PlayerZ = MemoryReader.Z;

                    Point3D playerCoordinate = new Point3D(PlayerX, PlayerY, PlayerZ);
                    if (previousCoordinate != playerCoordinate) {
                        previousCoordinate = playerCoordinate;
                        mapCoordinate = new Coordinate(PlayerX, PlayerY, PlayerZ);
                    } else {
                        if (FakePlayerData.X >= 0) {
                            PlayerX = FakePlayerData.X;
                            PlayerY = FakePlayerData.Y;
                            PlayerZ = FakePlayerData.Z;

                            mapCoordinate = new Coordinate(PlayerX, PlayerY, PlayerZ);

                            FakePlayerData = new Point3D(-1, -1, -1);
                        } else {
                            if (periodicUpdate) return;
                            recomputeRoute = false;
                        }
                    }
                }
                if (beginCoordinate == null) {
                    beginCoordinate = new Coordinate(mapCoordinate);
                    beginWidth = sourceWidth;
                }
                if (beginCoordinate.x == Coordinate.MaxWidth / 2 && beginCoordinate.y == Coordinate.MaxHeight / 2 && beginCoordinate.z == 7) {
                    Image oldImage = this.Image;
                    this.Image = StyleManager.GetImage("nomapavailable.png");
                    if (oldImage != StyleManager.GetImage("nomapavailable.png") && oldImage != null) {
                        oldImage.Dispose();
                    }
                    this.SizeMode = PictureBoxSizeMode.Zoom;
                    return;
                }
                if (mapCoordinate.z < 0) {
                    mapCoordinate.z = 0;
                } else if (mapCoordinate.z >= StorageManager.mapFilesCount) {
                    mapCoordinate.z = StorageManager.mapFilesCount - 1;
                }
                if (mapCoordinate.x - sourceWidth / 2 < 0) {
                    mapCoordinate.x = sourceWidth / 2;
                }
                if (mapCoordinate.x + sourceWidth / 2 > Coordinate.MaxWidth) {
                    mapCoordinate.x = Coordinate.MaxWidth - sourceWidth / 2;
                }
                if (mapCoordinate.y - sourceWidth / 2 < 0) {
                    mapCoordinate.y = sourceWidth / 2;
                }
                if (mapCoordinate.y + sourceWidth / 2 > Coordinate.MaxHeight) {
                    mapCoordinate.y = Coordinate.MaxHeight - sourceWidth / 2;
                }

                Image image;
                if (mapCoordinate.z == zCoordinate) {
                    image = map != null ? map.GetImage() : mapImage;
                } else {
                    Map m = StorageManager.getMap(mapCoordinate.z);
                    if (otherMap != null && m != otherMap) {
                        otherMap.Dispose();
                    }
                    otherMap = m;
                    image = m.GetImage();
                }

                lock (image) {
                    sourceWidth = Math.Min(Math.Max(sourceWidth, minWidth), maxWidth);
                    Rectangle sourceRectangle = new Rectangle(mapCoordinate.x - sourceWidth / 2, mapCoordinate.y - sourceWidth / 2, sourceWidth, sourceWidth);
                    Bitmap bitmap = new Bitmap(this.Width, this.Height);
                    using (Graphics gr = Graphics.FromImage(bitmap)) {
                        gr.DrawImage(image, new Rectangle(0, 0, bitmap.Width, bitmap.Height), sourceRectangle, GraphicsUnit.Pixel);

                        if (targetCoordinate != null && recomputeRoute) {
                            Coordinate beginCoordinate = new Coordinate(PlayerX, PlayerY, PlayerZ);

                            Node beginNode = Pathfinder.GetNode(beginCoordinate.x, beginCoordinate.y, beginCoordinate.z);
                            Node endNode = Pathfinder.GetNode(targetCoordinate.x, targetCoordinate.y, targetCoordinate.z);

                            List<Rectangle3D> collisionBounds = null;
                            DijkstraNode highresult = Dijkstra.FindRoute(beginNode, endNode, new Point3D(targetCoordinate), previousResult);
                            previousResult = highresult;
                            SpecialConnection connection = null;

                            nextConnectionPoint = new Point3D(-1, -1, -1);
                            nextImportantTarget = null;
                            nextTarget = "Head to the destination.";
                            if (highresult != null) {
                                collisionBounds = new List<Rectangle3D>();
                                while (highresult != null) {
                                    highresult.rect.Inflate(5, 5);
                                    collisionBounds.Add(new Rectangle3D(highresult.rect, highresult.node.z));
                                    /*if (highresult.node.z == beginCoordinate.z) {
                                        Point tl = new Point(convertx(highresult.rect.X), converty(highresult.rect.Y));
                                        Point tr = new Point(convertx(highresult.rect.X + highresult.rect.Width), converty(highresult.rect.Y + highresult.rect.Height));
                                        gr.DrawRectangle(Pens.Yellow, new Rectangle(tl.X, tl.Y, (tr.X - tl.X), (tr.Y - tl.Y)));
                                    }*/
                                    if (highresult.connection.connection != null) {
                                        connection = highresult.connection.connection;
                                        if (connection.name.Equals("stairs", StringComparison.InvariantCultureIgnoreCase)) {
                                            nextTarget = connection.destination.z > connection.source.z ? "Go down the stairs." : "Go up the stairs.";
                                        } else if (connection.name.Equals("levitate", StringComparison.InvariantCultureIgnoreCase)) {
                                            nextTarget = connection.destination.z > connection.source.z ? "Levitate down." : "Levitate up.";
                                        } else {
                                            nextImportantTarget = String.Format("Take the {0}.", connection.name);
                                            nextTarget = null;
                                        }
                                        nextConnectionPoint = new Point3D(connection.destination.x, connection.destination.y, connection.destination.z);
                                    }
                                    highresult = highresult.previous;
                                }
                                if (collisionBounds.Count == 0) collisionBounds = null;
                            }

                            Map m = StorageManager.getMap(beginCoordinate.z);
                            DijkstraPoint result = Dijkstra.FindRoute(image as Bitmap, new Point3D(beginCoordinate), new Point3D(targetCoordinate), collisionBounds, null, connection);
                            if (result != null) {
                                playerPath = new TibiaPath();
                                playerPath.path = result;
                                playerPath.begin = beginCoordinate;
                                playerPath.end = targetCoordinate;
                                DrawPath(gr, playerPath);
                            }
                        } else if (!recomputeRoute && playerPath != null) {
                            DrawPath(gr, playerPath);
                        }

                        foreach (TibiaPath path in paths) {
                            DrawPath(gr, path);
                        }

                        foreach (Target target in targets) {
                            if (target.coordinate.z == mapCoordinate.z) {
                                int x = target.coordinate.x - (mapCoordinate.x - sourceWidth / 2);
                                int y = target.coordinate.y - (mapCoordinate.y - sourceWidth / 2);
                                if (x >= 0 && y >= 0 && x < sourceWidth && y < sourceWidth) {
                                    x = (int)((double)x / sourceWidth * bitmap.Width);
                                    y = (int)((double)y / sourceWidth * bitmap.Height);
                                    lock (target.image) {
                                        int targetWidth = (int)((double)target.size / target.image.Height * target.image.Width);
                                        gr.DrawImage(target.image, new Rectangle(x - targetWidth, y - target.size, targetWidth * 2, target.size * 2));
                                    }
                                }
                            }
                        }
                    }
                    Image oldImage = this.Image;
                    this.Image = bitmap;
                    if (oldImage != null) {
                        oldImage.Dispose();
                    }
                }
                if (MapUpdated != null)
                    MapUpdated();
            }
        }
예제 #5
0
        public void UpdateMap() {
            if (beginCoordinate == null) {
                beginCoordinate = new Coordinate(mapCoordinate);
                beginWidth = sourceWidth;
            }
            if (beginCoordinate.x == Coordinate.MaxWidth / 2 && beginCoordinate.y == Coordinate.MaxHeight / 2 && beginCoordinate.z == 7) {
                if (this.Image != MainForm.nomapavailable && this.Image != null) {
                    this.Image.Dispose();
                }
                this.Image = MainForm.nomapavailable;
                this.SizeMode = PictureBoxSizeMode.Zoom;
                return;
            }
            if (mapCoordinate.z < 0) {
                mapCoordinate.z = 0;
            } else if (mapCoordinate.z >= MainForm.mapFilesCount) {
                mapCoordinate.z = MainForm.mapFilesCount - 1;
            }
            if (mapCoordinate.x - sourceWidth / 2 < 0) {
                mapCoordinate.x = sourceWidth / 2;
            }
            if (mapCoordinate.x + sourceWidth / 2 > map.image.Width) {
                mapCoordinate.x = map.image.Width - sourceWidth / 2;
            }
            if (mapCoordinate.y - sourceWidth / 2 < 0) {
                mapCoordinate.y = sourceWidth / 2;
            }
            if (mapCoordinate.y + sourceWidth / 2 > map.image.Height) {
                mapCoordinate.y = map.image.Height - sourceWidth / 2;
            }

            sourceWidth = Math.Min(Math.Max(sourceWidth, minWidth), maxWidth);
            Rectangle sourceRectangle = new Rectangle(mapCoordinate.x - sourceWidth / 2, mapCoordinate.y - sourceWidth / 2, sourceWidth, sourceWidth);
            Bitmap bitmap = new Bitmap(this.Width, this.Height);
            using (Graphics gr = Graphics.FromImage(bitmap)) {
                if (mapCoordinate.z == zCoordinate) {
                    gr.DrawImage(map != null ? map.image : mapImage, new Rectangle(0, 0, bitmap.Width, bitmap.Height), sourceRectangle, GraphicsUnit.Pixel);
                } else {
                    Map m = MainForm.getMap(mapCoordinate.z);
                    if (otherMap != null && m != otherMap) {
                        otherMap.Dispose();
                    }
                    otherMap = m;
                    gr.DrawImage(m.image, new Rectangle(0, 0, bitmap.Width, bitmap.Height), sourceRectangle, GraphicsUnit.Pixel);
                }
                foreach(TibiaPath path in paths) {
                    if (path.begin.z == mapCoordinate.z) {
                        List<Point> points = new List<Point>();
                        DijkstraPoint node = path.path;
                        while (node != null) {
                            points.Add(new Point(convertx(node.point.X), converty(node.point.Y)));
                            node = node.previous;
                        }
                        gr.DrawLines(MainForm.pathPen, points.ToArray());
                    }
                }

                foreach (Target target in targets) {
                    if (target.coordinate.z == mapCoordinate.z) {
                        int x = target.coordinate.x - (mapCoordinate.x - sourceWidth / 2);
                        int y = target.coordinate.y - (mapCoordinate.y - sourceWidth / 2);
                        if (x >= 0 && y >= 0 && x < sourceWidth && y < sourceWidth) {
                            x = (int)((double)x / sourceWidth * bitmap.Width);
                            y = (int)((double)y / sourceWidth * bitmap.Height);
                            int targetWidth = (int)((double)target.size / target.image.Height * target.image.Width);
                            gr.DrawImage(target.image, new Rectangle(x - targetWidth, y - target.size, targetWidth * 2, target.size * 2));
                        }
                    }
                }
            }
            if (this.Image != null) {
                this.Image.Dispose();
            }
            this.Image = bitmap;
            if (MapUpdated != null)
                MapUpdated();
        }
예제 #6
0
        public static void InitializeStorage()
        {
            if (File.Exists(Constants.NewDatabaseFile)) {
                try {
                    if (File.Exists(Constants.OldDatabaseFile)) {
                        File.Delete(Constants.OldDatabaseFile);
                    }
                    File.Move(Constants.DatabaseFile, Constants.OldDatabaseFile);
                    File.Move(Constants.NewDatabaseFile, Constants.DatabaseFile);
                    // new database file present, update the database
                    conn = new SQLiteConnection(String.Format("Data Source={0};Version=3;", Constants.DatabaseFile));
                    conn.Open();

                    SQLiteConnection oldConnection = new SQLiteConnection(String.Format("Data Source={0};Version=3;", Constants.OldDatabaseFile));
                    oldConnection.Open();
                    UpdateDatabase(oldConnection);
                    oldConnection.Close();
                } catch(Exception ex) {
                    try {
                        if (File.Exists(Constants.OldDatabaseFile)) {
                            File.Move(Constants.OldDatabaseFile, Constants.DatabaseFile);
                        }
                        if (File.Exists(Constants.NewDatabaseFile)) {
                            File.Delete(Constants.NewDatabaseFile);
                        }
                    } catch {

                    }
                    MainForm.mainForm.DisplayWarning("Failed to update database: " + ex.Message);
                    conn = new SQLiteConnection(String.Format("Data Source={0};Version=3;", Constants.DatabaseFile));
                    conn.Open();
                }
            } else {
                conn = new SQLiteConnection(String.Format("Data Source={0};Version=3;", Constants.DatabaseFile));
                conn.Open();
            }

            SQLiteCommand command;
            SQLiteDataReader reader;
            // Quests
            command = new SQLiteCommand("SELECT id, title, name, minlevel, premium, city, legend FROM Quests", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                Quest quest = new Quest();
                quest.id = reader.GetInt32(0);
                quest.title = reader.GetString(1);
                quest.name = reader.GetString(2);
                quest.minlevel = reader.GetInt32(3);
                quest.premium = reader.GetBoolean(4);
                quest.city = reader.IsDBNull(5) ? "-" : reader.GetString(5);
                quest.legend = reader.IsDBNull(6) ? "No legend available." : reader.GetString(6);
                if (quest.legend == "..." || quest.legend == "")
                    quest.legend = "No legend available.";

                questIdMap.Add(quest.id, quest);
                questNameMap.Add(quest.name.ToLower(), quest);
            }

            // Quest Rewards
            command = new SQLiteCommand("SELECT questid, itemid FROM QuestRewards", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                questIdMap[reader.GetInt32(0)].rewardItems.Add(reader.GetInt32(1));
            }

            // Quest Outfits
            command = new SQLiteCommand("SELECT questid, outfitid FROM QuestOutfits", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                int questid = reader.GetInt32(0);
                int outfitid = reader.GetInt32(1);
                questIdMap[questid].rewardOutfits.Add(outfitid);
            }

            // Quest Dangers
            command = new SQLiteCommand("SELECT questid, creatureid FROM QuestDangers", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                questIdMap[reader.GetInt32(0)].questDangers.Add(reader.GetInt32(1));
            }

            // Quest Item Requirements
            command = new SQLiteCommand("SELECT questid, count, itemid FROM QuestItemRequirements", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                questIdMap[reader.GetInt32(0)].questRequirements.Add(new Tuple<int, int>(reader.GetInt32(1), reader.GetInt32(2)));
            }

            // Quest Additional Requirements
            command = new SQLiteCommand("SELECT questid, requirementtext FROM QuestAdditionalRequirements", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                questIdMap[reader.GetInt32(0)].additionalRequirements.Add(reader.GetString(1));
            }

            // Quest Instructions
            command = new SQLiteCommand("SELECT questid, beginx, beginy, beginz, endx, endy, endz, description, ordering, missionname, settings FROM QuestInstructions ORDER BY ordering", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                QuestInstruction instruction = new QuestInstruction();
                instruction.questid = reader.GetInt32(0);
                instruction.begin = new Coordinate(reader.GetInt32(1), reader.GetInt32(2), reader.GetInt32(3));
                if (reader.IsDBNull(4)) {
                    instruction.end = new Coordinate(DATABASE_NULL, DATABASE_NULL, reader.GetInt32(6));
                } else {
                    instruction.end = new Coordinate(reader.GetInt32(4), reader.GetInt32(5), reader.GetInt32(6));
                }
                instruction.description = reader.IsDBNull(7) ? "" : reader.GetString(7);
                instruction.ordering = reader.GetInt32(8);
                instruction.settings = reader.IsDBNull(10) ? null : reader.GetString(10);
                string missionName = reader.IsDBNull(9) ? "Guide" : reader.GetString(9);

                Quest quest = questIdMap[instruction.questid];

                if (!quest.questInstructions.ContainsKey(missionName))
                    quest.questInstructions.Add(missionName, new List<QuestInstruction>());
                quest.questInstructions[missionName].Add(instruction);
            }
            // Cities
            command = new SQLiteCommand("SELECT id, name, x, y, z FROM Cities", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                City city = new City();
                city.id = reader.GetInt32(0);
                city.name = reader.GetString(1).ToLower();
                city.location = new Coordinate(reader.GetInt32(2), reader.GetInt32(3), reader.GetInt32(4));

                cityIdMap.Add(city.id, city);
                cityNameMap.Add(city.name, city);
            }
            // City Utilities
            command = new SQLiteCommand("SELECT cityid,name,x,y,z FROM CityUtilities", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                int cityid = reader.GetInt32(0);
                Utility utility = new Utility();
                utility.name = reader.GetString(1).ToLower();
                utility.location = new Coordinate(reader.GetInt32(2), reader.GetInt32(3), reader.GetInt32(4));

                cityIdMap[cityid].utilities.Add(utility);
            }
            // Events
            command = new SQLiteCommand("SELECT id, title, location, creatureid FROM Events", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                int eventid = reader.GetInt32(0);
                Event ev = new Event();
                ev.id = eventid;
                ev.title = reader.GetString(1);
                ev.location = reader.GetString(2);
                ev.creatureid = reader.GetInt32(3);
                eventIdMap.Add(eventid, ev);
            }
            // Event Messages
            command = new SQLiteCommand("SELECT eventid,message FROM EventMessages ", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                Event ev = eventIdMap[reader.GetInt32(0)];
                ev.eventMessages.Add(reader.GetString(1));
            }
            // Task Groups
            command = new SQLiteCommand("SELECT id,name FROM TaskGroups", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                int id = reader.GetInt32(0);
                string name = reader.GetString(1);
                taskList.Add(name.ToLower(), new List<Task>());
                taskGroups.Add(id, name);
                questNameMap["killing in the name of... quest"].questInstructions.Add(name, new List<QuestInstruction> { new QuestInstruction { specialCommand = "task" + Constants.CommandSymbol + name } });
            }
            // Tasks
            command = new SQLiteCommand("SELECT id,groupid,count,taskpoints,bossid,bossx,bossy,bossz,name FROM Tasks", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                Task task = new Task();
                task.id = reader.GetInt32(0);
                task.groupid = reader.GetInt32(1);
                task.groupname = taskGroups[task.groupid];
                task.count = reader.GetInt32(2);
                task.taskpoints = reader.IsDBNull(3) ? DATABASE_NULL : reader.GetInt32(3);
                task.bossid = reader.IsDBNull(4) ? DATABASE_NULL : reader.GetInt32(4);
                task.bossposition = new Coordinate();
                task.bossposition.x = reader.IsDBNull(5) ? task.bossposition.x : reader.GetInt32(5);
                task.bossposition.y = reader.IsDBNull(6) ? task.bossposition.y : reader.GetInt32(6);
                task.bossposition.z = reader.IsDBNull(7) ? task.bossposition.z : reader.GetInt32(7);
                task.name = reader.GetString(8);

                taskIdMap.Add(task.id, task);

                // Task Creatures
                SQLiteCommand command2 = new SQLiteCommand(String.Format("SELECT creatureid FROM TaskCreatures WHERE taskid={0}", task.id), conn);
                SQLiteDataReader reader2 = command2.ExecuteReader();
                while (reader2.Read()) {
                    task.creatures.Add(reader2.GetInt32(0));
                }
                command2 = new SQLiteCommand(String.Format("SELECT huntingplaceid FROM TaskHunts WHERE taskid={0}", task.id), conn);
                reader2 = command2.ExecuteReader();
                while (reader2.Read()) {
                    task.hunts.Add(reader2.GetInt32(0));
                }
                taskList[task.groupname.ToLower()].Add(task);
            }
            command = new SQLiteCommand("SELECT command, description FROM CommandHelp", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                helpCommands.Add(new HelpCommand { command = reader["command"].ToString(), description = reader["description"].ToString() });
            }

            // Maps
            command = new SQLiteCommand("SELECT z FROM WorldMap", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                Map m = new Map();
                m.z = reader.GetInt32(0);
                StorageManager.mapFiles.Add(m);
            }

            // Houses
            command = new SQLiteCommand("SELECT id,name,city,x,y,z,sqm,beds,guildhall FROM Houses", conn);
            reader = command.ExecuteReader();
            while (reader.Read()) {
                House house = new House();
                house.id = reader.GetInt32(0);
                house.name = reader[1].ToString();
                house.city = reader[2].ToString();
                house.pos.x = reader.GetInt32(3);
                house.pos.y = reader.GetInt32(4);
                house.pos.z = reader.GetInt32(5);
                house.sqm = reader.GetInt32(6);
                house.beds = reader.GetInt32(7);
                house.guildhall = reader.GetBoolean(8);
                if (house.guildhall) {
                    guildHallIdMap.Add(house.id, house);
                } else {
                    houseIdMap.Add(house.id, house);
                }
            }
        }
예제 #7
0
 private void initializeMaps()
 {
     SQLiteCommand command = new SQLiteCommand("SELECT z FROM WorldMap", conn);
     SQLiteDataReader reader = command.ExecuteReader();
     while (reader.Read()) {
         Map m = new Map();
         m.z = reader.GetInt32(0);
         mapFiles.Add(m);
     }
 }
예제 #8
0
        public override void LoadForm()
        {
            if (house == null)
            {
                return;
            }

            this.SuspendForm();
            NotificationInitialize();
            houseName.Text = house.GetName().ToTitle();
            Font f = StyleManager.FontList[0];

            for (int i = 0; i < StyleManager.FontList.Count; i++)
            {
                Font font = StyleManager.FontList[i];
                Size size = TextRenderer.MeasureText(this.houseName.Text, font);
                if (size.Width < houseName.MaximumSize.Width && size.Height < houseName.MaximumSize.Height)
                {
                    f = font;
                }
                else
                {
                    break;
                }
            }
            this.houseName.Font = f;

            cityLabel.Text = house.city.ToString();
            sizeLabel.Text = String.Format("{0} sqm", house.sqm);
            bedLabel.Text  = house.beds.ToString();
            if (house.world != null)
            {
                statusLabel.Text = house.occupied ? "rented" : (house.hoursleft <= 0 ? "free" : "auctioned");
                if (house.occupied || house.hoursleft < 0)
                {
                    timeLeftLabel.Visible  = false;
                    timeLeftHeader.Visible = false;
                }
                else
                {
                    timeLeftLabel.Text = String.Format("{0}{1}", house.hoursleft > 24 ? house.hoursleft / 24 : house.hoursleft, house.hoursleft > 24 ? "D" : "h");
                }
            }
            else
            {
                timeLeftHeader.Visible = false;
                statusHeader.Visible   = false;
                timeLeftLabel.Visible  = false;
                statusLabel.Visible    = false;
            }

            Map m = StorageManager.getMap(house.pos.z);

            mapBox.map      = m;
            mapBox.mapImage = null;

            Target t = new Target();

            t.coordinate = new Coordinate(house.pos);
            t.image      = house.GetImage();
            t.size       = 20;

            mapBox.targets.Add(t);
            mapBox.sourceWidth   = mapBox.Width;
            mapBox.mapCoordinate = new Coordinate(house.pos);
            mapBox.zCoordinate   = house.pos.z;
            mapBox.UpdateMap();

            UnregisterControl(mapBox);

            this.mapUpLevel.Image = StyleManager.GetImage("mapup.png");
            this.UnregisterControl(mapUpLevel);
            this.mapUpLevel.Click  += mapUpLevel_Click;
            this.mapDownLevel.Image = StyleManager.GetImage("mapdown.png");
            this.UnregisterControl(mapDownLevel);
            this.mapDownLevel.Click += mapDownLevel_Click;

            base.NotificationFinalize();
            this.ResumeForm();
        }