Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        private void refreshVocationSpells()
        {
            updateCommand();
            foreach (Control c in npcControls)
            {
                this.Controls.Remove(c);
                c.Dispose();
            }
            npcControls.Clear();
            for (int i = 0; i < 4; i++)
            {
                if (vocationControls[i] != null)
                {
                    vocationControls[i].Enabled = i != currentVocation;
                    if (i == currentVocation)
                    {
                        (vocationControls[i] as Label).BorderStyle = BorderStyle.Fixed3D;
                    }
                    else
                    {
                        (vocationControls[i] as Label).BorderStyle = BorderStyle.FixedSingle;
                    }
                }
            }
            int newwidth = 0;
            int y        = baseY;

            if (currentVocation >= 0)
            {
                y = baseY + MainForm.DisplayCreatureAttributeList(this.Controls, npcList[currentVocation], 10, baseY, out newwidth, null, npcControls, 0, 20, null, "Cost", goldCostFunction, sortHeader, sortedHeader, desc);
            }
            this.Size = new Size(Math.Max(this.Size.Width, newwidth), y + 20);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public void refreshDamageChart()
        {
            foreach (Control c in controlList)
            {
                c.Dispose();
                Controls.Remove(c);
            }
            controlList.Clear();
            if (graph)
            {
                this.mChart.Visible = true;
                this.mChart.Series[0].Points.Clear();
                for (int i = 0; i < damageDealt.Count; i++)
                {
                    DamageObject p          = damageDealt[i];
                    double       percentage = p.percentage;
                    DataPoint    point      = new DataPoint();
                    point.XValue     = percentage;
                    point.YValues    = new double[1];
                    point.YValues[0] = p.totalDamage;
                    point.AxisLabel  = p.name;
                    point.LegendText = p.name;
                    point.Label      = Math.Round(percentage, 1).ToString() + "%";
                    this.mChart.Series[0].Points.Add(point);
                }
                this.mChart.ApplyPaletteColors();
                for (int i = 0; i < damageDealt.Count; i++)
                {
                    DamageObject p = damageDealt[i];
                    p.color = this.mChart.Series[0].Points[i].Color;
                }
                this.Size = new Size(startX, startY);
            }
            else
            {
                this.mChart.Series[0].Points.Clear();
                this.mChart.Visible = false;
                int newWidth = 0;
                int y        = MainForm.DisplayCreatureAttributeList(Controls, damageDealt.ToList <TibiaObject>(), 5, 25, out newWidth, null, controlList, 0, 20, null, null, null, sortFunction, sortedHeader, desc);

                this.Size = new Size(Math.Max(startX, newWidth), Math.Max(startY, 25 + y));
            }
            refreshTimer();
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        private void refresh()
        {
            foreach (Control c in controlList)
            {
                this.Controls.Remove(c);
                c.Dispose();
            }
            if (currentControlList == -1)
            {
                return;
            }
            updateCommand();
            for (int i = 0; i < headers.Length; i++)
            {
                if (objectControls[i] != null)
                {
                    objectControls[i].Enabled = i != currentControlList;
                    if (i == currentControlList)
                    {
                        (objectControls[i] as Label).BorderStyle = BorderStyle.Fixed3D;
                    }
                    else
                    {
                        (objectControls[i] as Label).BorderStyle = BorderStyle.FixedSingle;
                    }
                }
            }
            controlList.Clear();
            int newwidth;

            MainForm.PageInfo pageInfo = new MainForm.PageInfo(false, false);
            int y = base_y + MainForm.DisplayCreatureAttributeList(this.Controls, objectList[currentControlList], 10, base_y, out newwidth, null, controlList, currentPage, 15, pageInfo, extraAttributes[currentControlList], attributeFunctions[currentControlList], sortHeader, sortedHeader, desc, attributeSortFunctions[currentControlList], removedLists[currentControlList]);

            newwidth = Math.Max(newwidth, this.Size.Width);
            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);
                    controlList.Add(prevpage);
                }
                if (pageInfo.nextPage)
                {
                    PictureBox nextpage = new PictureBox();
                    nextpage.Location  = new Point(newwidth - 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);
                    controlList.Add(nextpage);
                }
                y += 25;
            }
            this.Size = new Size(newwidth, y + 10);
        }
Exemplo n.º 7
0
        private void refresh()
        {
            foreach (Control c in createdControls)
            {
                this.Controls.Remove(c);
                c.Dispose();
            }
            int base_y   = this.listTitle.Location.Y + this.listTitle.Height + 10;
            int newWidth = 352;

            MainForm.PageInfo pageInfo = new MainForm.PageInfo(false, false);

            int y;

            if (displayType == DisplayType.Details)
            {
                y = MainForm.DisplayCreatureAttributeList(this.Controls, objects, 10, base_y, out newWidth, null, createdControls, currentPage, 20, pageInfo, null, null, sortHeader, sortedHeader, desc, null, null, addConditionalAttributes);
            }
            else
            {
                y = MainForm.DisplayCreatureList(this.Controls, objects, 10, base_y, 344, 4, null, 1, createdControls, currentPage, 600, pageInfo, currentDisplay);
                if (currentDisplay >= 0)
                {
                    currentDisplay = -1;
                    currentPage    = pageInfo.currentPage;
                }
            }
            startDisplay = pageInfo.startDisplay;
            updateCommand();

            newWidth = Math.Max(newWidth, 275);
            if (pageInfo.prevPage)
            {
                PictureBox prevpage = new PictureBox();
                prevpage.Location  = new Point(10, base_y + y);
                prevpage.Size      = new Size(97, 23);
                prevpage.Image     = MainForm.prevpage_image;
                prevpage.BackColor = Color.Transparent;
                prevpage.SizeMode  = PictureBoxSizeMode.StretchImage;
                prevpage.Click    += Prevpage_Click;
                this.Controls.Add(prevpage);
                createdControls.Add(prevpage);
            }
            if (pageInfo.nextPage)
            {
                PictureBox nextpage = new PictureBox();
                nextpage.Location  = new Point(10 + newWidth - 108, base_y + y);
                nextpage.Size      = new Size(98, 23);
                nextpage.BackColor = Color.Transparent;
                nextpage.Image     = MainForm.nextpage_image;
                nextpage.SizeMode  = PictureBoxSizeMode.StretchImage;
                nextpage.Click    += Nextpage_Click;
                this.Controls.Add(nextpage);
                createdControls.Add(nextpage);
            }
            toggleButton.Location = new Point(newWidth - toggleButton.Size.Width, toggleButton.Location.Y);
            if (pageInfo.prevPage || pageInfo.nextPage)
            {
                y += 23;
            }
            this.Size = new Size(10 + newWidth, base_y + y + 10);
            this.refreshTimer();
        }