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(StorageManager.getCreature(creatureid)); } } else { foreach (int huntid in task.hunts) { taskCreatures.Add(StorageManager.getHunt(huntid)); } } int newWidth; int y = UIManager.DisplayCreatureAttributeList(this.Controls, taskCreatures, 5, baseHeight, out newWidth, null, createdControls); this.Size = new System.Drawing.Size(Math.Max(newWidth, baseWidth), baseHeight + y); }
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 + UIManager.DisplayCreatureAttributeList(this.Controls, npcList[currentVocation], 10, baseY, out newwidth, null, npcControls, 0, 10, null, "Cost", goldCostFunction, sortHeader, sortedHeader, desc); } this.Size = new Size(Math.Max(this.Size.Width, newwidth), y + 20); }
public void RefreshTaskList(int baseY) { foreach (Control c in taskControls) { Controls.Remove(c); } taskControls.Clear(); List <Task> involvedTasks = new List <Task>(); foreach (KeyValuePair <string, List <Task> > kvp in StorageManager.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 newWidth; int y = UIManager.DisplayCreatureAttributeList(Controls, involvedTasks.ToList <TibiaObject>(), 10, baseY, out newWidth, null, taskControls, 0, 20, null, null, null, null, null, false, null, null, false, this.Size.Width - 20); this.Size = new Size(this.Size.Width, baseY + y); } }
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(); int max = SettingsManager.getSettingInt("MaxDamageChartPlayers"); for (int i = 0; i < damageDealt.Count; i++) { if (max > 0 && i >= max) { break; } 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++) { if (max > 0 && i >= max) { break; } DamageObject p = damageDealt[i]; p.color = this.mChart.Series[0].Points[i].Color; } this.Size = new Size(GetWidth(), (int)(GetWidth() * 0.9)); } else { this.mChart.Series[0].Points.Clear(); this.mChart.Visible = false; int newWidth = 0; int y = UIManager.DisplayCreatureAttributeList(Controls, damageDealt.ToList <TibiaObject>(), 5, 25, out newWidth, null, controlList, 0, 20, null, null, null, sortFunction, sortedHeader, desc, null, null, false, this.Size.Width - 20); this.Size = new Size(GetWidth(), Math.Max(startY, 25 + y)); } refreshTimer(); }
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 = StorageManager.getCreature(creatureid); creatures.Add(cr); } PageInfo pageInfo = new PageInfo(false, false); int newWidth; int y = baseY + UIManager.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 = StyleManager.GetImage("prevpage.png"); 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 = StyleManager.GetImage("nextpage.png"); 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); }
private void refreshItems(Control suspend, Control.ControlCollection controls, List <TibiaObject> tibiaObjects, string sortedHeader, bool desc, EventHandler eventHandler, int maxItems = 20) { int maxWidth = 0; this.SuspendLayout(); NotificationForm.SuspendDrawing(suspend); foreach (Control c in controls) { c.Dispose(); } controls.Clear(); UIManager.DisplayCreatureAttributeList(controls, tibiaObjects, 0, 10, out maxWidth, null, null, 0, maxItems, null, null, null, eventHandler, sortedHeader, desc); NotificationForm.ResumeDrawing(suspend); this.ResumeLayout(false); }
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; PageInfo pageInfo = new PageInfo(false, false); int y = base_y + UIManager.DisplayCreatureAttributeList(this.Controls, objectList[currentControlList], 10, base_y, out newwidth, null, controlList, currentPage, 10, 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 = StyleManager.GetImage("prevpage.png"); 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 = StyleManager.GetImage("nextpage.png"); nextpage.SizeMode = PictureBoxSizeMode.Zoom; nextpage.Click += Nextpage_Click;; this.Controls.Add(nextpage); controlList.Add(nextpage); } y += 25; } this.Size = new Size(newwidth, y + 10); }
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; PageInfo pageInfo = new PageInfo(false, false); int y; if (displayType == DisplayType.Details) { y = UIManager.DisplayCreatureAttributeList(this.Controls, objects, 10, base_y, out newWidth, null, createdControls, currentPage, 20, pageInfo, null, null, sortHeader, sortedHeader, desc, null, null, addConditionalAttributes); } else { y = UIManager.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 = StyleManager.GetImage("prevpage.png"); 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 = StyleManager.GetImage("nextpage.png"); 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(); }
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 = StyleManager.NotificationBackgroundColor; this.nameLabel.Text = this.creature.displayname.ToTitle(); Font f = StyleManager.FontList[0]; Font prevFont = f; for (int i = 0; i < StyleManager.FontList.Count; i++) { Font font = StyleManager.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 = StorageManager.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 ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png"); 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 ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png"); 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 ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png"); 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 ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png"); 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 ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png"); 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 ? StyleManager.GetImage("checkmark-yes.png") : StyleManager.GetImage("checkmark-no.png"); 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 StorageManager.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 = UIManager.DisplayCreatureAttributeList(Controls, involvedTasks.ToList <TibiaObject>(), 10, baseY, out newWidth); this.Size = new Size(Math.Max(newWidth, Size.Width), baseY + y); } base.NotificationFinalize(); this.ResumeForm(); }