Esempio n. 1
0
        public TibiaObject getTibiaObject()
        {
            if (tibiaObject == null)
            {
                switch (type)
                {
                case TibiaObjectType.Creature:
                    tibiaObject = MainForm.getCreature(id);
                    break;

                case TibiaObjectType.Item:
                    tibiaObject = MainForm.getItem(id);
                    break;

                case TibiaObjectType.NPC:
                    tibiaObject = MainForm.getNPC(id);
                    break;

                case TibiaObjectType.Mount:
                    tibiaObject = MainForm.getMount(id);
                    break;

                case TibiaObjectType.Outfit:
                    tibiaObject = MainForm.getOutfit(id);
                    break;

                case TibiaObjectType.Spell:
                    tibiaObject = MainForm.getSpell(id);
                    break;
                }
            }
            return(tibiaObject);
        }
Esempio n. 2
0
        private void refreshAttributes()
        {
            foreach (Control c in createdControls)
            {
                c.Dispose();
                this.Controls.Remove(c);
            }
            createdControls.Clear();
            List <TibiaObject> taskCreatures = new List <TibiaObject>();

            if (viewCreatures)
            {
                foreach (int creatureid in task.creatures)
                {
                    taskCreatures.Add(MainForm.getCreature(creatureid));
                }
            }
            else
            {
                foreach (int huntid in task.hunts)
                {
                    taskCreatures.Add(MainForm.getHunt(huntid));
                }
            }
            int newWidth;
            int y = MainForm.DisplayCreatureAttributeList(this.Controls, taskCreatures, 5, baseHeight, out newWidth, null, createdControls);

            this.Size = new System.Drawing.Size(Math.Max(newWidth, baseWidth), baseHeight + y);
        }
Esempio n. 3
0
 public override IComparable GetHeaderValue(int header)
 {
     if (header == hashes[0])
     {
         return(name);
     }
     if (header == hashes[1])
     {
         Item i = MainForm.getItem(tameitemid);
         if (i == null)
         {
             return("");
         }
         return(i.displayname);
     }
     if (header == hashes[2])
     {
         Creature cr = MainForm.getCreature(tamecreatureid);
         if (cr == null)
         {
             return("");
         }
         return(cr.displayname);
     }
     if (header == hashes[3])
     {
         return(tibiastore);
     }
     return(base.GetHeaderValue(header));
 }
Esempio n. 4
0
 public Creature GetBoss()
 {
     if (bossid < 0)
     {
         return(null);
     }
     return(MainForm.getCreature(bossid));
 }
Esempio n. 5
0
        public override List <Attribute> GetAttributes()
        {
            Item     i            = MainForm.getItem(tameitemid);
            Creature cr           = MainForm.getCreature(tamecreatureid);
            string   itemName     = i == null ? "-" : MainForm.ToTitle(i.displayname);
            string   creatureName = cr == null ? "-" : MainForm.ToTitle(cr.displayname);

            return(new List <Attribute> {
                new StringAttribute(name, 120), new StringAttribute(itemName, 80), new StringAttribute(creatureName, 80), new BooleanAttribute(tibiastore)
            });
        }
Esempio n. 6
0
        public override void LoadForm()
        {
            if (mount == null)
            {
                return;
            }
            this.SuspendLayout();
            NotificationInitialize();

            this.mountTitle.Text     = mount.name;
            this.mountImageBox.Image = mount.image;
            if (mount.tibiastore)
            {
                this.tameItemImageBox.Visible      = false;
                this.tameItemLabel.Visible         = false;
                this.tameCreatureImageBox.Image    = MainForm.tibia_store_image;
                this.tameCreatureLabel.Text        = "Tibia Store";
                this.tameCreatureImageBox.Location = new System.Drawing.Point(this.tameCreatureImageBox.Location.X, this.tameCreatureImageBox.Location.Y - 50);
                this.tameCreatureLabel.Location    = new System.Drawing.Point(this.tameCreatureLabel.Location.X, this.tameCreatureLabel.Location.Y - 50);
            }
            else if (mount.tamecreatureid > 0 && mount.tameitemid > 0)
            {
                Creature tameCreature = MainForm.getCreature(mount.tamecreatureid);
                Item     tameItem     = MainForm.getItem(mount.tameitemid);

                this.tameCreatureImageBox.Image = tameCreature.image;
                this.tameCreatureLabel.Text     = MainForm.ToTitle(tameCreature.displayname);
                this.tameItemImageBox.Image     = tameItem.image;
                this.tameItemLabel.Text         = MainForm.ToTitle(tameItem.displayname);

                tameCreatureImageBox.Name = tameCreature.GetName();
                tameCreatureLabel.Name    = tameCreature.GetName();
                tameItemImageBox.Name     = tameItem.GetName();
                tameItemLabel.Name        = tameItem.GetName();

                this.tameCreatureLabel.Click    += TameCreatureImageBox_Click;
                this.tameCreatureImageBox.Click += TameCreatureImageBox_Click;
                this.tameItemImageBox.Click     += TameItemImageBox_Click;
                this.tameItemLabel.Click        += TameItemImageBox_Click;
            }
            else
            {
                this.tameCreatureImageBox.Visible = false;
                this.tameCreatureLabel.Visible    = false;
                this.tameItemImageBox.Visible     = false;
                this.tameItemLabel.Visible        = false;
            }


            base.NotificationFinalize();
            this.ResumeLayout(false);
        }
Esempio n. 7
0
        private void refreshCreatures()
        {
            foreach (Control c in creatureControls)
            {
                Controls.Remove(c);
                c.Dispose();
            }

            List <TibiaObject> creatures = new List <TibiaObject>();

            foreach (int creatureid in hunting_place.creatures)
            {
                Creature cr = MainForm.getCreature(creatureid);
                creatures.Add(cr);
            }

            MainForm.PageInfo pageInfo = new MainForm.PageInfo(false, false);
            int newWidth;
            int y = baseY + MainForm.DisplayCreatureAttributeList(this.Controls, creatures, 10, baseY, out newWidth, null, creatureControls, currentPage, 10, pageInfo, null, null, sortFunction, sortedHeader, desc);

            if (pageInfo.prevPage || pageInfo.nextPage)
            {
                if (pageInfo.prevPage)
                {
                    PictureBox prevpage = new PictureBox();
                    prevpage.Location  = new Point(10, y);
                    prevpage.Size      = new Size(97, 23);
                    prevpage.Image     = MainForm.prevpage_image;
                    prevpage.BackColor = Color.Transparent;
                    prevpage.SizeMode  = PictureBoxSizeMode.Zoom;
                    prevpage.Click    += Prevpage_Click;
                    this.Controls.Add(prevpage);
                    creatureControls.Add(prevpage);
                }
                if (pageInfo.nextPage)
                {
                    PictureBox nextpage = new PictureBox();
                    nextpage.Location  = new Point(Math.Max(newWidth, this.Size.Width) - 108, y);
                    nextpage.Size      = new Size(98, 23);
                    nextpage.BackColor = Color.Transparent;
                    nextpage.Image     = MainForm.nextpage_image;
                    nextpage.SizeMode  = PictureBoxSizeMode.Zoom;
                    nextpage.Click    += Nextpage_Click;
                    this.Controls.Add(nextpage);
                    creatureControls.Add(nextpage);
                }
                y += 25;
            }
            refreshTimer();
            this.Size = new Size(Math.Max(this.Size.Width, newWidth), y + 10);
        }
Esempio n. 8
0
 public Creature GetDangerCreature()
 {
     if (this.questDangers.Count > 0)
     {
         List <Creature> creatures = new List <Creature>();
         foreach (int i in this.questDangers)
         {
             Creature cr = MainForm.getCreature(i);
             creatures.Add(cr);
         }
         return(creatures.OrderByDescending(o => o.experience).First());
     }
     return(null);
 }
Esempio n. 9
0
        public override Image GetImage()
        {
            Creature cr = MainForm.getCreature(creatures[0]);

            return(cr.GetImage());
        }
Esempio n. 10
0
        private int drawDirections(Coordinate begin, Coordinate end, string settings, string description, int start_x, int y, bool variableSize, int imageCount, bool noText, out int width)
        {
            int  mapSize = this.Size.Width / 2;
            Size minSize = new Size(mapSize, mapSize);

            List <Color>  additionalWalkableColors = new List <Color>();
            List <Target> targetList = new List <Target>();

            // parse settings
            if (settings != null)
            {
                string[] splits = settings.ToLower().Split('@');
                foreach (string split in splits)
                {
                    string[] setting = split.Split('=');
                    switch (setting[0])
                    {
                    case "walkablecolor":
                        string[] rgb = setting[1].Split(',');
                        additionalWalkableColors.Add(Color.FromArgb(int.Parse(rgb[0]), int.Parse(rgb[1]), int.Parse(rgb[2])));
                        break;

                    case "marking":
                        Target   target     = new Target();
                        string[] coordinate = setting[1].Split(',');
                        target.size       = 12;
                        target.image      = MainForm.cross_image;
                        target.coordinate = new Coordinate(int.Parse(coordinate[0]), int.Parse(coordinate[1]), int.Parse(coordinate[2]));
                        targetList.Add(target);
                        break;

                    case "markicon":
                        Image image = null;
                        switch (setting[1].ToLower())
                        {
                        case "item":
                            image = MainForm.getItem(setting[2]).image;
                            break;

                        case "npc":
                            image = MainForm.getNPC(setting[2]).image;
                            break;

                        case "cr":
                            image = MainForm.getCreature(setting[2]).image;
                            break;

                        case "spell":
                            image = MainForm.getSpell(setting[2]).image;
                            break;

                        case "object":
                            image = MainForm.getWorldObject(setting[2]).image;
                            break;

                        default:
                            throw new Exception("Unknown image type " + setting[1] + ".");
                        }
                        targetList[targetList.Count - 1].image = image;
                        break;

                    case "marksize":
                        targetList[targetList.Count - 1].size = int.Parse(setting[1]);
                        break;
                    }
                }
            }
            if (targetList.Count == 0)
            {
                targetList = null;
            }

            MapPictureBox map = MainForm.DrawRoute(begin, end, variableSize ? new Size(0, 0) : new Size(mapSize, mapSize), minSize, new Size(mapSize, mapSize), additionalWalkableColors, targetList);

            width = map.Width + 5;
            if (!noText)
            {
                map.Location = new Point(this.Size.Width - (map.Width + 5), y);
            }
            else
            {
                map.Location = new Point(start_x, y);
            }
            map.MapUpdated += refreshTimer;
            this.Controls.Add(map);
            addedControls.Add(map);
            if (noText)
            {
                return(y + map.Height + 5);
            }
            if (description.Contains("@"))
            {
                int      x = 5;
                int      minheightoffset = 20;
                string[] questStrings    = description.Split('@');
                int      minY            = y + map.Size.Height + 10;
                foreach (string instruction in questStrings)
                {
                    if (instruction == "")
                    {
                        y += 10;
                        continue;
                    }
                    if (instruction.Contains("="))
                    {
                        string[] splits = instruction.Split('=');
                        if (splits[0].ToLower() == "cr" || splits[0].ToLower() == "npc" || splits[0].ToLower() == "item")
                        {
                            bool   blockWidth  = true;
                            string imageString = splits[1];
                            if (splits[1].Contains(';'))
                            {
                                string[] options = splits[1].Split(';');
                                imageString = options[0];
                                for (int i = 1; i < options.Length; i++)
                                {
                                    if (options[i].ToLower() == "blockheight")
                                    {
                                        blockWidth = false;
                                    }
                                }
                            }
                            string command = "";
                            Image  image   = null;
                            if (splits[0].ToLower() == "cr")
                            {
                                Creature cr = MainForm.getCreature(imageString);
                                image   = cr.GetImage();
                                command = "creature" + MainForm.commandSymbol + cr.GetName().ToLower();
                            }
                            else if (splits[0].ToLower() == "npc")
                            {
                                NPC npc = MainForm.getNPC(imageString);
                                image   = npc.GetImage();
                                command = "npc" + MainForm.commandSymbol + npc.GetName().ToLower();
                            }
                            else if (splits[0].ToLower() == "item")
                            {
                                Item item = MainForm.getItem(imageString);
                                image   = item.GetImage();
                                command = "item" + MainForm.commandSymbol + item.GetName().ToLower();
                            }
                            PictureBox pictureBox = new PictureBox();
                            pictureBox.Location  = new Point(x, y);
                            pictureBox.Image     = image;
                            pictureBox.SizeMode  = PictureBoxSizeMode.Zoom;
                            pictureBox.Size      = new Size(image.Width, image.Height);
                            pictureBox.BackColor = Color.Transparent;
                            pictureBox.Name      = command;
                            pictureBox.Click    += QuestTitle_Click;
                            if (blockWidth)
                            {
                                x += pictureBox.Size.Width;
                                minheightoffset = pictureBox.Size.Height + 5;
                            }
                            else
                            {
                                y += pictureBox.Size.Height;
                            }

                            addedControls.Add(pictureBox);
                            this.Controls.Add(pictureBox);
                            continue;
                        }
                    }
                    Label label = new Label();
                    label.Location    = new Point(x, y);
                    label.ForeColor   = MainForm.label_text_color;
                    label.BackColor   = Color.Transparent;
                    label.Font        = requirementFont;
                    label.AutoSize    = true;
                    label.MaximumSize = new Size(this.Size.Width - (map.Size.Width) - x, 0);
                    string labelText = CreateLinks(label, instruction);
                    label.Text = labelText == "" ? "" : "- " + labelText;

                    int labelHeight = 0;
                    using (Graphics gr = Graphics.FromHwnd(label.Handle)) {
                        labelHeight = (int)(gr.MeasureString(label.Text, label.Font, this.Size.Width - (map.Size.Width + 10) - x, StringFormat.GenericTypographic).Height * 1.2);
                    }
                    addedControls.Add(label);
                    this.Controls.Add(label);
                    y += Math.Max(labelHeight, minheightoffset);
                    minheightoffset = 0;
                    x = 5;
                }
                if (y < minY)
                {
                    y = minY;
                }
            }
            else
            {
                Label label = new Label();
                label.Location  = new Point(5, y);
                label.ForeColor = MainForm.label_text_color;
                label.BackColor = Color.Transparent;
                label.Font      = requirementFont;
                string labelText = CreateLinks(label, description);
                label.Text = labelText == "" ? "" : "- " + labelText;
                Size size;
                using (Graphics gr = Graphics.FromHwnd(label.Handle)) {
                    size       = gr.MeasureString(label.Text, label.Font, this.Size.Width - (map.Size.Width + 10)).ToSize();
                    label.Size = new Size(this.Size.Width - (map.Size.Width + 5), Math.Max((int)(size.Height * 1.3), map.Size.Height));
                }
                addedControls.Add(label);
                this.Controls.Add(label);
                y += Math.Max(label.Size.Height, map.Size.Height) + 10;
            }
            return(y);
        }