public override IComparable GetHeaderValue(int hash) { if (hash == hashes[0]) { return(name); } if (hash == hashes[1]) { return(premium); } if (hash == hashes[2]) { return(tibiastore); } if (hash == hashes[3]) { Quest q = MainForm.getQuest(questid); if (q == null) { return(""); } return(q.name); } return(base.GetHeaderValue(hash)); }
public override List <Attribute> GetAttributes() { Quest q = MainForm.getQuest(questid); return(new List <Attribute> { new StringAttribute(name, 140), new BooleanAttribute(premium), new BooleanAttribute(tibiastore), new StringAttribute(q == null ? "-" : q.name, 100) }); }
public override void LoadForm() { if (outfit == null) { return; } this.SuspendLayout(); NotificationInitialize(); this.outfitTitle.Text = outfit.name; this.maleAddon0.Image = outfit.maleImages[0]; this.maleAddon1.Image = outfit.maleImages[1]; this.maleAddon2.Image = outfit.maleImages[2]; this.maleAddon3.Image = outfit.maleImages[3]; this.femaleAddon0.Image = outfit.femaleImages[0]; this.femaleAddon1.Image = outfit.femaleImages[1]; this.femaleAddon2.Image = outfit.femaleImages[2]; this.femaleAddon3.Image = outfit.femaleImages[3]; if (outfit.questid > 0) { Quest quest = MainForm.getQuest(outfit.questid); this.obtainedLabel.Text = "Rewarded by " + quest.name; obtainedCommand = "quest" + MainForm.commandSymbol + quest.name; this.obtainedLabel.Click += ObtainedLabel_Click; } else if (outfit.tibiastore) { this.obtainedLabel.Text = "Purchased from the Tibia Store."; } else { this.obtainedLabel.Visible = false; } base.NotificationFinalize(); this.ResumeLayout(false); }
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); }