public Reward GetReward(int number, out int repeatCount) { if (reward_repeat_count == 0 && max_repeat_count > 0) repeatCount = 1; else repeatCount = reward_repeat_count; if (number < 1 || number > 4) return null; Reward reward = new Reward(); List<Item> items = new List<Item>(); switch (number) { case 1: reward.Title = reward_title1; if (!String.IsNullOrEmpty(reward_exp1)) { int exp; if (Int32.TryParse(reward_exp1.Trim(), out exp)) reward.Exp = exp; } reward.Gold = reward_gold1; reward.Inventory = reward_extend_inventory1; reward.IsStigma = reward_extend_stigma1; reward.AbyssPoints = reward_abyss_point1; AddRewardItem(ref items, reward_item1_1); AddRewardItem(ref items, reward_item1_2); AddRewardItem(ref items, reward_item1_3); reward.BasicItems = items; items = new List<Item>(); AddRewardItem(ref items, selectable_reward_item1_1); AddRewardItem(ref items, selectable_reward_item1_2); AddRewardItem(ref items, selectable_reward_item1_3); AddRewardItem(ref items, selectable_reward_item1_4); AddRewardItem(ref items, selectable_reward_item1_5); AddRewardItem(ref items, selectable_reward_item1_6); AddRewardItem(ref items, selectable_reward_item1_7); AddRewardItem(ref items, selectable_reward_item1_8); break; case 2: reward.Title = reward_title2; if (!String.IsNullOrEmpty(reward_exp2)) { int exp; if (Int32.TryParse(reward_exp2.Trim(), out exp)) reward.Exp = exp; } reward.Gold = reward_gold2; reward.AbyssPoints = reward_abyss_point2; AddRewardItem(ref items, reward_item2_1); reward.BasicItems = items; items = new List<Item>(); AddRewardItem(ref items, selectable_reward_item2_1); AddRewardItem(ref items, selectable_reward_item2_2); AddRewardItem(ref items, selectable_reward_item2_3); AddRewardItem(ref items, selectable_reward_item2_4); AddRewardItem(ref items, selectable_reward_item2_5); AddRewardItem(ref items, selectable_reward_item2_6); break; case 3: if (!String.IsNullOrEmpty(reward_exp3)) { int exp; if (Int32.TryParse(reward_exp3.Trim(), out exp)) reward.Exp = exp; } reward.Gold = reward_gold3; reward.AbyssPoints = reward_abyss_point3; AddRewardItem(ref items, reward_item3_1); reward.BasicItems = items; items = new List<Item>(); AddRewardItem(ref items, selectable_reward_item3_1); AddRewardItem(ref items, selectable_reward_item3_2); AddRewardItem(ref items, selectable_reward_item3_3); AddRewardItem(ref items, selectable_reward_item3_4); AddRewardItem(ref items, selectable_reward_item3_5); break; case 4: if (!String.IsNullOrEmpty(reward_exp4)) { int exp; if (Int32.TryParse(reward_exp4.Trim(), out exp)) reward.Exp = exp; } reward.Gold = reward_gold4; reward.AbyssPoints = reward_abyss_point4; AddRewardItem(ref items, reward_item4_1); reward.BasicItems = items; items = new List<Item>(); AddRewardItem(ref items, selectable_reward_item4_1); AddRewardItem(ref items, selectable_reward_item4_2); AddRewardItem(ref items, selectable_reward_item4_3); AddRewardItem(ref items, selectable_reward_item4_4); AddRewardItem(ref items, selectable_reward_item4_5); break; default: return null; } reward.AbyssRank = abyss_rank; reward.Skill = combineskill; reward.SillPoint = combine_skillpoint; reward.Receipe = recipe_name; reward.SelectItems = items; return reward; }
public RewardList(Reward reward) : this() { _reward = reward; if (reward.Exp > 0) { string strExp = Utility.StringIndex.GetString("STR_QUEST_REWARD_EXP").Replace("%0", "{0}"); ListViewItem lvi = new ListViewItem(String.Format(" " + strExp, reward.Exp), 2); listBasicRewards.Items.Add(lvi); } if (reward.AbyssPoints > 0) { string strAbyssPt = Program.IniReader["abyssPoints"]; ListViewItem lvi = new ListViewItem(String.Format(" {0} " + strAbyssPt, reward.AbyssPoints), 0); listBasicRewards.Items.Add(lvi); } if (reward.Gold > 0) { string strKinah = Utility.StringIndex.GetString("STR_GOLD"); ListViewItem lvi = new ListViewItem(String.Format(" {0} " + strKinah, reward.Gold), 8); listBasicRewards.Items.Add(lvi); lvi.Tag = Utility.ItemIndex.GetItem("gold"); } if (!String.IsNullOrEmpty(reward.Title)) { string title = Utility.StringIndex.GetString("STR_QUEST_REWARD_TITLE").Replace("%0", "{0}"); ; ListViewItem lvi = new ListViewItem(String.Format(" " + title, Utility.StringIndex.GetString("STR_" + reward.Title.ToUpper())), 5); listBasicRewards.Items.Add(lvi); } foreach (Item item in reward.BasicItems) { string itemName = Utility.ItemIndex[item.name]; string iconName = item.icon_name + ".png"; string imagePath = Path.Combine(Environment.CurrentDirectory, @".\data\items\pics\" + iconName); ListViewItem lvi; // Load picture into the imageList if (File.Exists(imagePath)) { Image pic = Image.FromFile(imagePath); string key = item.id.ToString(); imageListBasic.Images.Add(key, pic); lvi = new ListViewItem(String.Format(" {0} (×{1})", itemName, item.Count), key); } else { lvi = new ListViewItem(String.Format(" {0} (×{1})", itemName, item.Count), 6); } listBasicRewards.Items.Add(lvi); lvi.Tag = item; lvi.ForeColor = ItemsFile.QualityColors[item.Quality]; } if (listBasicRewards.Items.Count == 0) { listBasicRewards.Visible = false; lblBasic.Visible = false; } else { listBasicRewards.Height = 41 * listBasicRewards.Items.Count; } foreach (Item item in reward.SelectItems) { string itemName = Utility.ItemIndex[item.name]; string iconName = item.icon_name + ".png"; string imagePath = Path.Combine(Environment.CurrentDirectory, @".\data\items\pics\" + iconName); ListViewItem lvi; // Load picture into the imageList if (File.Exists(imagePath)) { Image pic = Image.FromFile(imagePath); string key = item.id.ToString(); imageListSelectable.Images.Add(key, pic); lvi = new ListViewItem(String.Format(" {0} (×{1})", itemName, item.Count), key); } else { lvi = new ListViewItem(String.Format(" {0} (×{1})", itemName, item.Count), 6); } listSelectRewards.Items.Add(lvi); lvi.Tag = item; lvi.ForeColor = ItemsFile.QualityColors[item.Quality]; } if (listSelectRewards.Items.Count == 0) { listSelectRewards.Visible = false; lblSelectable.Visible = false; } else { listSelectRewards.Height = 41 * listSelectRewards.Items.Count; } }