Exemple #1
0
 public override List <Attribute> GetAttributes()
 {
     return(new List <Attribute> {
         new StringAttribute(name, 120),
         new StringAttribute(MainForm.ToTitle(city), 80)
     });
 }
Exemple #2
0
        public override void LoadForm()
        {
            this.SuspendForm();
            base.NotificationInitialize();

            this.cityNameLabel.Text = MainForm.ToTitle(city.name);
            mapBox             = MainForm.DrawRoute(city.location, new Coordinate(-1, -1, mapSize.Width), mapSize, mapSize, mapSize, new List <Color>(), new List <Target>());
            mapBox.Location    = new Point(5, cityNameLabel.Location.Y + cityNameLabel.Height);
            mapBox.MapUpdated += ResetTimer;
            this.Controls.Add(mapBox);

            baseHeight = this.Size.Height;
            int listHeight = InitializeList(city.utilities, null);

            this.Size = new Size(this.Size.Width, Math.Max(listHeight, baseHeight));

            npcButton.Click         -= c_Click;
            utilityButton.Click     -= c_Click;
            huntButton.Click        -= c_Click;
            questButton.Click       -= c_Click;
            nextButton.Click        -= c_Click;
            previousButton.Click    -= c_Click;
            this.mapUpLevel.Image    = MainForm.mapup_image;
            this.mapUpLevel.Click   -= c_Click;
            this.mapDownLevel.Image  = MainForm.mapdown_image;
            this.mapDownLevel.Click -= c_Click;

            this.NotificationFinalize();
            this.ResumeForm();
        }
Exemple #3
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)
            });
        }
Exemple #4
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);
        }
Exemple #5
0
        public override void LoadForm()
        {
            this.SuspendForm();
            base.NotificationInitialize();
            // load image from the creature
            this.mainImage.Image  = this.creature.GetImage();
            this.statsButton.Name = this.creature.GetName().ToLower();
            this.huntButton.Name  = this.creature.GetName().ToLower();
            // set background of actual form to transparent
            this.BackColor = MainForm.background_color;
            this.Opacity   = MainForm.opacity;
            if (MainForm.transparent)
            {
                this.TransparencyKey = MainForm.background_color;
                this.Opacity         = 1;
            }
            CombineItems();
            this.nameLabel.Text = MainForm.ToTitle(this.creature.displayname);
            Font f        = MainForm.fontList[0];
            Font prevFont = f;

            for (int i = 0; i < MainForm.fontList.Count; i++)
            {
                Font font  = MainForm.fontList[i];
                int  width = TextRenderer.MeasureText(this.nameLabel.Text, font).Width;
                if (width < this.mainImage.Size.Width)
                {
                    f = prevFont;
                }
                else
                {
                    break;
                }
                prevFont = font;
            }
            this.nameLabel.Font = f;
            this.nameLabel.Left = this.mainImage.Left + (mainImage.Width - this.nameLabel.Size.Width) / 2;
            this.NotificationFinalize();
            this.ResumeForm();
        }
        public override void LoadForm()
        {
            this.SuspendForm();
            int horizontal, left, right;

            this.statsButton.Name = creature.GetName().ToLower();
            this.huntButton.Name  = creature.GetName().ToLower();
            int health     = creature.health;
            int experience = creature.experience;
            List <Resistance> resistances = new List <Resistance>();

            resistances.Add(new Resistance("Ice", creature.res_ice));
            resistances.Add(new Resistance("Holy", creature.res_holy));
            resistances.Add(new Resistance("Death", creature.res_death));
            resistances.Add(new Resistance("Phys", creature.res_phys));
            resistances.Add(new Resistance("Earth", creature.res_earth));
            resistances.Add(new Resistance("Energy", creature.res_energy));
            resistances.Add(new Resistance("Fire", creature.res_fire));
            // load image from the creature
            this.mainImage.Image = creature.GetImage();
            // set health of creature
            this.healthLabel.Text = (health > 0 ? health.ToString() + " Health" : "Unknown");
            horizontal            = 96 - healthLabel.Size.Width;
            left  = horizontal / 2;
            right = horizontal - left;
            this.healthLabel.Padding = new Padding(left, 2, right, 2);
            // set exp of creature
            this.expLabel.Text = (experience >= 0 ? experience.ToString() : "Unknown") + " Exp";
            horizontal         = 96 - expLabel.Size.Width;
            left  = horizontal / 2;
            right = horizontal - left;
            this.expLabel.Padding = new Padding(left, 2, right, 2);
            // add resistances of creature in order
            AddResistances(resistances);
            // set background of actual form to transparent
            this.BackColor = MainForm.background_color;
            this.Opacity   = MainForm.opacity;
            if (MainForm.transparent)
            {
                this.TransparencyKey = MainForm.background_color;
                this.Opacity         = 1;
            }
            this.nameLabel.Text = MainForm.ToTitle(this.creature.displayname);
            Font f        = MainForm.fontList[0];
            Font prevFont = f;

            for (int i = 0; i < MainForm.fontList.Count; i++)
            {
                Font font  = MainForm.fontList[i];
                int  width = TextRenderer.MeasureText(this.nameLabel.Text, font).Width;
                if (width < this.mainImage.Size.Width)
                {
                    f = prevFont;
                }
                else
                {
                    break;
                }
                prevFont = font;
            }

            string goldstring  = "";
            double averageGold = 0;

            foreach (ItemDrop itemDrop in creature.itemdrops)
            {
                if (itemDrop.percentage > 0)
                {
                    Item item = MainForm.getItem(itemDrop.itemid);
                    averageGold += ((itemDrop.max + itemDrop.min) / 2.0) * itemDrop.percentage * item.GetMaxValue() / 100;
                }
            }
            if (averageGold < 10000)
            {
                goldstring = ((long)averageGold).ToString();
            }
            else if (averageGold < 1000000)
            {
                goldstring = ((long)averageGold / 1000).ToString() + "K";
            }
            else
            {
                goldstring = ((long)averageGold / 1000000).ToString() + "M";
            }
            this.averageGoldLabel.Text = "Average Gold: " + goldstring;

            this.maxDamageLabel.Text        = "Max Damage: " + (this.creature.maxdamage >= 0 ? this.creature.maxdamage.ToString() : "-");
            this.abilitiesLabel.Text        = RemoveTextInBrackets(this.creature.abilities.Replace(", ", "\n"));
            this.abilitiesLabel.BorderStyle = BorderStyle.FixedSingle;

            string tooltip;

            this.illusionableBox.Image = creature.illusionable ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = creature.illusionable ? "Creature illusion works for this creature." : "Creature illusion does not work for this creature.";
            resistance_tooltip.SetToolTip(illusionableBox, tooltip);
            resistance_tooltip.SetToolTip(illusionableLabel, tooltip);
            this.summonableBox.Image = creature.summoncost > 0 ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = creature.summoncost > 0 ? "This creature can be summoned for " + creature.summoncost + " mana." : "This creature cannot be summoned.";
            resistance_tooltip.SetToolTip(summonableBox, tooltip);
            resistance_tooltip.SetToolTip(summonableLabel, tooltip);
            this.invisibleBox.Image = !creature.senseinvis ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = !creature.senseinvis ? "This creature does not detect invisibility." : "This creature detects invisibility.";
            resistance_tooltip.SetToolTip(invisibleBox, tooltip);
            resistance_tooltip.SetToolTip(invisibleLabel, tooltip);
            this.paralysableBox.Image = creature.paralysable ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = creature.paralysable ? "This creature can be paralysed." : "This creature cannot be paralysed.";
            resistance_tooltip.SetToolTip(paralysableBox, tooltip);
            resistance_tooltip.SetToolTip(paralysableLabel, tooltip);
            this.pushableBox.Image = creature.pushable ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = creature.pushable ? "This creature can be pushed." : "This creature cannot be pushed.";
            resistance_tooltip.SetToolTip(pushableBox, tooltip);
            resistance_tooltip.SetToolTip(pushableLabel, tooltip);
            this.pushesBox.Image = creature.pushes ? MainForm.checkmark_yes : MainForm.checkmark_no;
            tooltip = creature.pushes ? "This creature pushes smaller creatures." : "This creature cannot push smaller creatures.";
            resistance_tooltip.SetToolTip(pushesBox, tooltip);
            resistance_tooltip.SetToolTip(pushesLabel, tooltip);

            this.Size           = new Size(this.Size.Width, (int)Math.Max(this.abilitiesLabel.Location.Y + this.abilitiesLabel.Size.Height + 10, this.expLabel.Location.Y + this.expLabel.Height + 10));
            this.nameLabel.Font = f;
            this.nameLabel.Left = this.mainImage.Left + (mainImage.Width - this.nameLabel.Size.Width) / 2;
            base.NotificationInitialize();

            List <Task> involvedTasks = new List <Task>();

            foreach (KeyValuePair <string, List <Task> > kvp in MainForm.taskList)
            {
                foreach (Task t in kvp.Value)
                {
                    if (t.bossid == creature.id)
                    {
                        involvedTasks.Add(t);
                    }
                    foreach (int cr in t.creatures)
                    {
                        if (cr == creature.id)
                        {
                            involvedTasks.Add(t);
                        }
                    }
                }
            }
            if (involvedTasks.Count > 0)
            {
                int baseY    = this.Size.Height;
                int newWidth = 0;
                int y        = MainForm.DisplayCreatureAttributeList(Controls, involvedTasks.ToList <TibiaObject>(), 10, baseY, out newWidth);
                this.Size = new Size(Math.Max(newWidth, Size.Width), baseY + y);
            }

            base.NotificationFinalize();
            this.ResumeForm();
        }
Exemple #7
0
        public override void LoadForm()
        {
            if (npc == null)
            {
                return;
            }

            this.SuspendForm();
            NotificationInitialize();
            npcImage.Image    = npc.GetImage();
            creatureName.Text = MainForm.ToTitle(npc.city);
            Font f = MainForm.fontList[0];

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

            for (int i = 0; i < headers.Length; i++)
            {
                objectList[i] = new List <TibiaObject>();
            }
            extraAttributes[0]        = "Value";
            attributeFunctions[0]     = SellPrice;
            attributeSortFunctions[0] = SellSort;
            removedLists[0]           = new List <string> {
                "Value"
            };
            foreach (ItemSold itemSold in npc.sellItems)
            {
                objectList[0].Add(new LazyTibiaObject {
                    id = itemSold.itemid, type = TibiaObjectType.Item
                });
            }
            extraAttributes[1]        = "Price";
            attributeFunctions[1]     = BuyPrice;
            attributeSortFunctions[1] = BuySort;
            removedLists[1]           = new List <string> {
                "Value"
            };
            foreach (ItemSold itemSold in npc.buyItems)
            {
                objectList[1].Add(new LazyTibiaObject {
                    id = itemSold.itemid, type = TibiaObjectType.Item
                });
            }
            extraAttributes[2]        = "Vocation";
            attributeFunctions[2]     = SpellVoc;
            attributeSortFunctions[2] = SpellSort;
            removedLists[2]           = new List <string> {
                "Words"
            };
            foreach (SpellTaught spellTaught in npc.spellsTaught)
            {
                objectList[2].Add(new LazyTibiaObject {
                    id = spellTaught.spellid, type = TibiaObjectType.Spell
                });
            }
            // Transport
            foreach (Transport transport in npc.transportOffered)
            {
                objectList[3].Add(transport);
            }
            // Quests Involved In
            foreach (Quest q in npc.involvedQuests)
            {
                objectList[4].Add(q);
            }

            base_y = this.Size.Height;
            int x = 5;

            for (int i = 0; i < headers.Length; i++)
            {
                if (objectList[i].Count > 0)
                {
                    Label label = new Label();
                    label.Text        = headers[i];
                    label.Location    = new Point(x, base_y);
                    label.ForeColor   = MainForm.label_text_color;
                    label.BackColor   = Color.Transparent;
                    label.Font        = MainForm.text_font;
                    label.Size        = new Size(90, 25);
                    label.TextAlign   = ContentAlignment.MiddleCenter;
                    label.BorderStyle = BorderStyle.FixedSingle;
                    label.Name        = i.ToString();
                    label.Click      += toggleObjectDisplay;
                    objectControls[i] = label;
                    this.Controls.Add(label);
                    if (currentControlList < 0 || currentControlList > headers.Length)
                    {
                        currentControlList = i;
                    }
                    x += 90;
                }
                else
                {
                    objectControls[i] = null;
                }
            }
            base_y += 25;

            Map m = MainForm.getMap(npc.pos.z);

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

            Target t = new Target();

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

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

            mapBox.Click -= c_Click;

            this.mapUpLevel.Image    = MainForm.mapup_image;
            this.mapUpLevel.Click   -= c_Click;
            this.mapUpLevel.Click   += mapUpLevel_Click;
            this.mapDownLevel.Image  = MainForm.mapdown_image;
            this.mapDownLevel.Click -= c_Click;
            this.mapDownLevel.Click += mapDownLevel_Click;

            refresh();
            base.NotificationFinalize();
            this.ResumeForm();
        }
        public override void LoadForm()
        {
            this.SuspendForm();
            NotificationInitialize();
            if (hunting_place == null)
            {
                return;
            }
            this.cityLabel.Text        = hunting_place.city;
            this.huntingPlaceName.Text = MainForm.ToTitle(hunting_place.name);
            this.levelLabel.Text       = hunting_place.level < 0 ? "--" : hunting_place.level.ToString();

            if (hunting_place.directions.Count == 0)
            {
                guideButton.Visible = false;
            }

            int     y;
            ToolTip tooltip = new ToolTip();

            tooltip.AutoPopDelay = 60000;
            tooltip.InitialDelay = 500;
            tooltip.ReshowDelay  = 0;
            tooltip.ShowAlways   = true;
            tooltip.UseFading    = true;

            if (this.hunting_place.coordinates != null && this.hunting_place.coordinates.Count > 0)
            {
                int count = 1;
                foreach (Coordinate coordinate in this.hunting_place.coordinates)
                {
                    Label label = new Label();
                    label.ForeColor   = MainForm.label_text_color;
                    label.BackColor   = Color.Transparent;
                    label.Name        = (count - 1).ToString();
                    label.Font        = LootDropForm.loot_font;
                    label.Text        = count.ToString();
                    label.BorderStyle = BorderStyle.FixedSingle;
                    label.Size        = new Size(1, 1);
                    label.AutoSize    = true;
                    label.Location    = new Point(mapBox.Location.X + (count - 1) * 25, mapBox.Location.Y + mapBox.Size.Height + 5);
                    label.Click      += label_Click;
                    this.Controls.Add(label);
                    count++;
                }
                targetCoordinate = this.hunting_place.coordinates[0];
            }
            else
            {
                targetCoordinate = new Coordinate();
            }

            if (hunting_place.requirements != null && hunting_place.requirements.Count > 0)
            {
                int count = 0;
                y = 3;
                foreach (Requirements requirement in hunting_place.requirements)
                {
                    Label label = new Label();
                    label.ForeColor   = Color.Firebrick;
                    label.BackColor   = Color.Transparent;
                    label.Font        = requirement_font;
                    label.Location    = new Point(3, requirementLabel.Location.Y + requirementLabel.Size.Height + y);
                    label.AutoSize    = true;
                    label.MaximumSize = new Size(170, 0);
                    label.Text        = "- " + requirement.notes;
                    label.Name        = requirement.quest.name.ToString();
                    label.Click      += openQuest;
                    using (Graphics graphics = label.CreateGraphics()) {
                        y += (int)(Math.Ceiling(graphics.MeasureString(label.Text, label.Font).Width / 170.0)) * 14;
                    }
                    this.Controls.Add(label);
                    count++;
                }
            }
            else
            {
                this.requirementLabel.Hide();
            }

            baseY = this.creatureLabel.Location.Y + this.creatureLabel.Height + 5;


            //y = MainForm.DisplayCreatureList(this.Controls, creatures, 10, base_y, this.Size.Width, 4, null, 0.8f);

            Font f = MainForm.fontList[0];

            for (int i = 0; i < MainForm.fontList.Count; i++)
            {
                Font font  = MainForm.fontList[i];
                int  width = TextRenderer.MeasureText(this.huntingPlaceName.Text, font).Width;
                if (width < this.huntingPlaceName.Size.Width)
                {
                    f = font;
                }
                else
                {
                    break;
                }
            }

            Bitmap   bitmap = new Bitmap(experienceStarBox.Size.Width, experienceStarBox.Size.Height);
            Graphics gr     = Graphics.FromImage(bitmap);

            for (int i = 0; i < (this.hunting_place.exp_quality < 0 ? 5 : Math.Min(this.hunting_place.exp_quality, 5)); i++)
            {
                gr.DrawImage(MainForm.star_image[this.hunting_place.exp_quality < 0 ? 5 : this.hunting_place.exp_quality - 1], new Rectangle(i * experienceStarBox.Size.Width / 5, 0, experienceStarBox.Size.Width / 5, experienceStarBox.Size.Width / 5));
            }
            experienceStarBox.Image = bitmap;

            bitmap = new Bitmap(lootStarBox.Size.Width, lootStarBox.Size.Height);
            gr     = Graphics.FromImage(bitmap);
            for (int i = 0; i < (this.hunting_place.loot_quality < 0 ? 5 : Math.Min(this.hunting_place.loot_quality, 5)); i++)
            {
                gr.DrawImage(MainForm.star_image[this.hunting_place.loot_quality < 0 ? 5 : this.hunting_place.loot_quality - 1], new Rectangle(i * lootStarBox.Size.Width / 5, 0, lootStarBox.Size.Width / 5, lootStarBox.Size.Width / 5));
            }
            lootStarBox.Image = bitmap;

            this.huntingPlaceName.Font = f;
            this.refreshCreatures();
            UpdateMap();

            mapBox.Click -= c_Click;

            this.mapUpLevel.Image    = MainForm.mapup_image;
            this.mapUpLevel.Click   -= c_Click;
            this.mapUpLevel.Click   += mapUpLevel_Click;
            this.mapDownLevel.Image  = MainForm.mapdown_image;
            this.mapDownLevel.Click -= c_Click;
            this.mapDownLevel.Click += mapDownLevel_Click;
            base.NotificationFinalize();
            this.ResumeForm();
        }
Exemple #9
0
        public override void LoadForm()
        {
            if (quest == null)
            {
                return;
            }
            this.SuspendLayout();
            NotificationInitialize();

            wikiButton.Click -= c_Click;

            this.questTitle.Text  = quest.name;
            this.premiumBox.Image = quest.premium ? MainForm.checkmark_yes : MainForm.checkmark_no;
            this.cityLabel.Text   = quest.city == null ? "Unknown" : MainForm.ToTitle(quest.city);
            this.levelLabel.Text  = quest.minlevel.ToString();
            this.legendLabel.Text = quest.legend;

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

            foreach (int reward in quest.rewardItems)
            {
                Item item = MainForm.getItem(reward);
                rewards.Add(item);
            }
            rewards = rewards.OrderByDescending(o => (o as Item).GetMaxValue()).ToList <TibiaObject>();
            int x = 5;
            int y = 77;

            foreach (string missionName in quest.questInstructions.Keys)
            {
                if (quest.questInstructions[missionName].Count == 0)
                {
                    continue;
                }
                if (x + 150 >= this.Size.Width)
                {
                    x  = 5;
                    y += 25;
                }
                Label missionButton = new Label();
                missionButton.BackColor   = System.Drawing.Color.Transparent;
                missionButton.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                missionButton.Font        = wikiButton.Font;
                missionButton.ForeColor   = MainForm.label_text_color;
                missionButton.Location    = new System.Drawing.Point(x, y);
                missionButton.Name        = quest.questInstructions[missionName][0].specialCommand != null ? quest.questInstructions[missionName][0].specialCommand : "guide" + MainForm.commandSymbol + quest.name.ToLower() + MainForm.commandSymbol + "1" + MainForm.commandSymbol + missionName;
                missionButton.Padding     = new System.Windows.Forms.Padding(2);
                missionButton.Text        = missionName;
                missionButton.TextAlign   = System.Drawing.ContentAlignment.MiddleCenter;
                missionButton.Click      += MissionButton_Click;
                missionButton.Size        = new Size(150, 21);
                this.Controls.Add(missionButton);
                x += missionButton.Width + 5;
            }
            y += 25;
            using (Graphics gr = Graphics.FromHwnd(legendLabel.Handle)) {
                this.legendLabel.Location = new Point(legendLabel.Location.X, y);
                y += (int)gr.MeasureString(this.legendLabel.Text, this.legendLabel.Font, this.legendLabel.MaximumSize.Width).Height + 20;
            }

            if (this.quest.additionalRequirements.Count > 0 || this.quest.questRequirements.Count > 0)
            {
                Label label = new Label();
                label.Text      = "Requirements";
                label.Location  = new Point(5, y);
                label.ForeColor = MainForm.label_text_color;
                label.BackColor = Color.Transparent;
                label.Font      = questTitle.Font;
                label.Size      = new Size(this.Size.Width - 10, label.Height);
                this.Controls.Add(label);
                y += 25;

                // Item requirements
                if (this.quest.questRequirements.Count > 0)
                {
                    List <Tuple <int, Item> > requirements = new List <Tuple <int, Item> >();
                    foreach (Tuple <int, int> tpl in quest.questRequirements)
                    {
                        Item item = MainForm.getItem(tpl.Item2);
                        requirements.Add(new Tuple <int, Item>(tpl.Item1, item));
                    }
                    requirements = requirements.OrderBy(o => o.Item1 * o.Item2.GetMaxValue()).ToList();
                    List <TibiaObject> itemList = requirements.Select(o => o.Item2).ToList <TibiaObject>();

                    List <Control> itemControls = new List <Control>();
                    y = y + MainForm.DisplayCreatureList(this.Controls, itemList, 10, y, this.Size.Width - 10, 1, null, 1, itemControls);
                    int itemnr = 0;
                    foreach (Control control in itemControls)
                    {
                        control.BackgroundImage = MainForm.item_background;
                        int  itemCount = requirements[itemnr].Item1;
                        Item item      = requirements[itemnr].Item2;

                        (control as PictureBox).Image = LootDropForm.DrawCountOnItem(item, itemCount);

                        itemnr++;
                    }
                }

                // Text requirements
                if (this.quest.additionalRequirements.Count > 0)
                {
                    List <string> requirementStrings = this.quest.additionalRequirements.ToArray().ToList();
                    if (this.quest.minlevel > 0)
                    {
                        requirementStrings.Add(String.Format("You must be at least level {0}.", this.quest.minlevel));
                    }

                    y += 5;
                    Regex questRegex = new Regex("\\[([^]]+)\\]");
                    foreach (string text in requirementStrings)
                    {
                        label = new Label();
                        string txt = text;
                        Match  m   = questRegex.Match(txt);
                        label.ForeColor = MainForm.label_text_color;
                        if (m != null && m.Groups.Count > 1)
                        {
                            string quest = m.Groups[1].Value;
                            txt             = txt.Replace(m.Groups[0].Value, quest);
                            label.Name      = MainForm.getQuest(quest.ToLower()).GetCommand();
                            label.ForeColor = Color.FromArgb(105, 105, 255);
                            label.Click    += MissionButton_Click;
                        }
                        label.Text      = txt == "" ? "" : "- " + txt;
                        label.Location  = new Point(5, y);
                        label.BackColor = Color.Transparent;
                        label.Font      = QuestGuideForm.requirementFont;
                        Size size;
                        using (Graphics gr = Graphics.FromHwnd(label.Handle)) {
                            size       = gr.MeasureString(label.Text, label.Font, this.Size.Width - 50).ToSize();
                            label.Size = new Size(this.Size.Width - 10, (int)(size.Height * 1.2));
                        }
                        this.Controls.Add(label);
                        y += label.Size.Height;
                    }
                }
            }

            if (rewards.Count > 0 || quest.rewardOutfits.Count > 0)
            {
                Label label = new Label();
                label.Text      = "Rewards";
                label.Location  = new Point(40, y);
                label.ForeColor = MainForm.label_text_color;
                label.BackColor = Color.Transparent;
                label.Font      = questTitle.Font;
                this.Controls.Add(label);
                y += 25;
                if (rewards.Count > 0)
                {
                    List <Control> itemControls = new List <Control>();
                    y = y + MainForm.DisplayCreatureList(this.Controls, rewards, 10, y, this.Size.Width - 10, 1, null, 1, itemControls);
                }
                if (quest.rewardOutfits.Count > 0)
                {
                    List <Control> outfitControls = new List <Control>();

                    List <TibiaObject> rewardOutfits = new List <TibiaObject>();
                    foreach (int reward in quest.rewardOutfits)
                    {
                        Outfit outfit = MainForm.getOutfit(reward);
                        rewardOutfits.Add(outfit);
                    }

                    y = y + MainForm.DisplayCreatureList(this.Controls, rewardOutfits, 10, y, this.Size.Width - 10, 4, null, 1, outfitControls);
                }
            }
            this.Size = new Size(this.Size.Width, y + 20);

            base.NotificationFinalize();
            this.ResumeLayout(false);
        }
Exemple #10
0
 public override List <Attribute> GetAttributes()
 {
     return(new List <Attribute> {
         new StringAttribute(name, 140), new StringAttribute(minlevel.ToString(), 50), new StringAttribute(premium ? "Yes" : "No", 50, premium ? Color.SeaGreen : Color.RoyalBlue), new StringAttribute(MainForm.ToTitle(city), 100)
     });
 }
Exemple #11
0
        private int InitializeList(List <Utility> utilities, List <TibiaObject> tibiaObjects)
        {
            foreach (Control c in controlList)
            {
                this.Controls.Remove(c);
                c.Dispose();
            }
            controlList.Clear();

            int width  = tibiaObjects != null ? 48 : 32;
            int height = tibiaObjects != null ? 48 : 32;

            npcList = tibiaObjects;

            ToolTip nameTooltip = new ToolTip();

            nameTooltip.AutoPopDelay = 60000;
            nameTooltip.InitialDelay = 500;
            nameTooltip.ReshowDelay  = 0;
            nameTooltip.ShowAlways   = true;
            nameTooltip.UseFading    = true;

            totalCount = tibiaObjects != null ? tibiaObjects.Count : utilities.Count;

            mapBox.targets.Clear();

            int totalHeight = 0;
            int baseX       = mapBox.Location.X + mapBox.Size.Width + 5;
            int x           = baseX;
            int y           = mapBox.Location.Y;
            int index;

            for (index = baseIndex; index < totalCount; index++)
            {
                string     name       = "";
                Image      image      = null;
                Coordinate coordinate = null;

                if (tibiaObjects != null)
                {
                    name       = tibiaObjects[index].GetName();
                    image      = tibiaObjects[index].GetImage();
                    coordinate = new Coordinate((tibiaObjects[index] as NPC).pos);
                }
                else
                {
                    name       = utilities[index].name;
                    image      = MainForm.utilityImages[name];
                    coordinate = new Coordinate(utilities[index].location);
                }

                Target target = new Target();
                target.coordinate = coordinate;
                target.image      = image;
                target.size       = width / 2;
                mapBox.targets.Add(target);

                PictureBox utilityBox = new PictureBox();
                utilityBox.BackColor = Color.Transparent;
                utilityBox.Size      = new Size(width, height);
                utilityBox.Image     = image;
                utilityBox.Location  = new Point(x, y);
                utilityBox.Click    += UtilityBox_Click;
                utilityBox.Name      = index.ToString();
                utilityBox.SizeMode  = PictureBoxSizeMode.Zoom;
                nameTooltip.SetToolTip(utilityBox, MainForm.ToTitle(name));
                controlList.Add(utilityBox);
                this.Controls.Add(utilityBox);

                totalHeight = Math.Max(totalHeight, utilityBox.Height + utilityBox.Location.Y);

                x += width + 4;
                if (x + width + 4 > this.Size.Width)
                {
                    x  = baseX;
                    y += height + 4;
                }
                if (y > 270 - height - 4)
                {
                    break;
                }
            }
            nextIndex              = index + 1;
            nextButton.Visible     = nextIndex < totalCount - 1;
            previousButton.Visible = baseIndex > 0;
            mapBox.UpdateMap();
            return(totalHeight);
        }