private QuestRewardItemGroup BuildItemGroup(QuestRewardGroupType type, string itemPrefix, string countPrefix, string stainPrefix, string hqPrefix, int count) { List <QuestRewardItem> items = new List <QuestRewardItem>(); for (int i = 0; i < count; ++i) { Item itm = Quest.As <Item>(itemPrefix, i); int c = Quest.AsInt32(countPrefix, i); if (itm == null || itm.Key == 0 || c == 0) { continue; } Stain s = null; if (stainPrefix != null) { s = Quest.As <Stain>(stainPrefix, i); } bool isHq = false; if (hqPrefix != null) { isHq = Quest.AsBoolean(hqPrefix, i); } items.Add(new QuestRewardItem(itm, c, s, isHq)); } return(new QuestRewardItemGroup(items, type, null)); }
private QuestRewardItemGroup BuildItemGroup(QuestRewardGroupType type, string itemPrefix, string countPrefix, string stainPrefix, int count) { var items = new List <QuestRewardItem>(); for (var i = 0; i < count; ++i) { var itm = Quest.As <Item>(itemPrefix, i); var c = Quest.AsInt32(countPrefix, i); if (itm.Key == 0 || c == 0) { continue; } Stain s = null; if (stainPrefix != null) { s = Quest.As <Stain>(stainPrefix, i); } items.Add(new QuestRewardItem(itm, c, s)); } return(new QuestRewardItemGroup(items, type)); }
internal PreviousQuestRequirement(Quest quest) { const int QuestCount = 3; this.Type = (PrerequisiteQuestsRequirementType)quest.AsInt32("PreviousQuestJoin"); var contents = new List<Quest>(); for (var i = 0; i < QuestCount; ++i) { var c = quest.As<Quest>("PreviousQuest", i); if (c != null && c.Key != 0) contents.Add(c); } this.PreviousQuests = contents; }
internal PrerequisiteQuestsRequirement(Quest quest) { const int QuestCount = 3; this.Type = (PrerequisiteQuestsRequirementType)quest.AsInt32("PreviousQuestJoin"); var quests = new List<Quest>(); for (var i = 0; i < QuestCount; ++i) { var q = quest.As<Quest>("PreviousQuest", i); if (q.Key != 0) quests.Add(q); } this.Quests = quests; }
internal InstanceContentRequirement(Quest quest) { const int QuestCount = 3; this.Type = (PrerequisiteQuestsRequirementType)quest.AsInt32("InstanceContentJoin"); var contents = new List<InstanceContent>(); for (var i = 0; i < QuestCount; ++i) { var c = quest.As<InstanceContent>("InstanceContent", i); if (c.Key != 0) contents.Add(c); } this.InstanceContents = contents; }
private ClassJobRequirement[] BuildClassJobs() { const int Count = 2; var cjr = new List <ClassJobRequirement>(); for (var i = 0; i < Count; ++i) { var cjc = Quest.As <ClassJobCategory>(i); var lv = Quest.AsInt32("ClassLevel", i); if (cjc.Key != 0 && lv > 0) { cjr.Add(new ClassJobRequirement(cjc, lv)); } } return(cjr.ToArray()); }
internal PrerequisiteQuestsRequirement(Quest quest) { const int QuestCount = 3; this.Type = (PrerequisiteQuestsRequirementType)quest.AsInt32("PreviousQuestJoin"); var quests = new List <Quest>(); for (var i = 0; i < QuestCount; ++i) { var q = quest.As <Quest>("PreviousQuest", i); if (q.Key != 0) { quests.Add(q); } } this.Quests = quests; }
internal PreviousQuestRequirement(Quest quest) { const int QuestCount = 3; this.Type = (PrerequisiteQuestsRequirementType)quest.AsInt32("PreviousQuestJoin"); var contents = new List <Quest>(); for (var i = 0; i < QuestCount; ++i) { var c = quest.As <Quest>("PreviousQuest", i); if (c != null && c.Key != 0) { contents.Add(c); } } this.PreviousQuests = contents; }
internal InstanceContentRequirement(Quest quest) { const int QuestCount = 3; this.Type = (PrerequisiteQuestsRequirementType)quest.AsInt32("InstanceContentJoin"); var contents = new List <InstanceContent>(); for (var i = 0; i < QuestCount; ++i) { var c = quest.As <InstanceContent>("InstanceContent", i); if (c.Key != 0) { contents.Add(c); } } this.InstanceContents = contents; }
private QuestRewardItemGroup[] BuildItems() { const int CatalystCount = 3; const int Group1Count = 6; const int Group2Count = 5; var groupsType = Quest.AsInt32("ItemRewardType"); var t1 = QuestRewardGroupType.Unknown; var t2 = QuestRewardGroupType.Unknown; switch (groupsType) { case 0: return(new QuestRewardItemGroup[0]); case 1: t1 = QuestRewardGroupType.All; t2 = QuestRewardGroupType.One; break; case 3: // Special handler break; case 5: t1 = QuestRewardGroupType.OnePerDay; t2 = QuestRewardGroupType.OnePerDay; break; } var groups = new List <QuestRewardItemGroup>(); var catalysts = BuildItemGroup(QuestRewardGroupType.All, "Item{Catalyst}", "ItemCount{Catalyst}", null, CatalystCount); groups.Add(catalysts); var tomestone = Quest.As <Tomestone>("Tomestone{Reward}"); var tomestoneCount = Quest.AsInt32("TomestoneCount{Reward}"); if (tomestone.Key != 0 && tomestoneCount > 0) { groups.Add( new QuestRewardItemGroup( new[] { new QuestRewardItem(tomestone.Item, tomestoneCount, null) }, QuestRewardGroupType.All)); } if (groupsType == 3) { { var mItem = Quest.As <Item>("Item{Reward}[0]", 0); var mCount = Quest.AsInt32("ItemCount{Reward}[0]", 0); var mStain = Quest.As <Stain>("Stain{Reward}[0]", 0); groups.Add( new QuestRewardItemGroup( new[] { new QuestRewardItem(mItem, mCount, mStain) }, QuestRewardGroupType.GenderSpecificMale)); } { var fItem = Quest.As <Item>("Item{Reward}[0]", 1); var fCount = Quest.AsInt32("ItemCount{Reward}[0]", 1); var fStain = Quest.As <Stain>("Stain{Reward}[0]", 1); groups.Add( new QuestRewardItemGroup( new[] { new QuestRewardItem(fItem, fCount, fStain) }, QuestRewardGroupType.GenderSpecificFemale)); } } else { groups.Add(BuildItemGroup(t1, "Item{Reward}[0]", "ItemCount{Reward}[0]", "Stain{Reward}[0]", Group1Count)); groups.Add(BuildItemGroup(t2, "Item{Reward}[1]", "ItemCount{Reward}[1]", "Stain{Reward}[1]", Group2Count)); } return(groups.Where(g => g.Items.Any()).ToArray()); }
private QuestRewardItemGroup[] BuildItems() { const int CatalystCount = 3; const int Group1Count = 6; const int Group2Count = 5; int groupsType = Quest.AsInt32("ItemRewardType"); QuestRewardGroupType t1 = QuestRewardGroupType.Unknown; QuestRewardGroupType t2 = QuestRewardGroupType.Unknown; switch (groupsType) { case 0: return(new QuestRewardItemGroup[0]); case 1: t1 = QuestRewardGroupType.All; t2 = QuestRewardGroupType.One; break; case 3: // Gender-specific rewards. case 7: // Beast rank bonuses. // Special handler break; case 5: t1 = QuestRewardGroupType.OnePerDay; t2 = QuestRewardGroupType.OnePerDay; break; case 6: // Relic quests break; } List <QuestRewardItemGroup> groups = new List <QuestRewardItemGroup>(); QuestRewardItemGroup catalysts = BuildItemGroup(QuestRewardGroupType.All, "Item{Catalyst}", "ItemCount{Catalyst}", null, null, CatalystCount); groups.Add(catalysts); int tomestoneCount = Quest.AsInt32("TomestoneCount{Reward}"); if (tomestoneCount > 0) { Item tomestoneItem = Quest.As <Item>("Tomestone{Reward}"); if (tomestoneItem != null) { groups.Add( new QuestRewardItemGroup( new[] { new QuestRewardItem(tomestoneItem, tomestoneCount, null, false) }, QuestRewardGroupType.All, null)); } } if (groupsType == 3) { { Item mItem = Quest.As <Item>("Item{Reward}[0]", 0); int mCount = Quest.AsInt32("ItemCount{Reward}[0]", 0); Stain mStain = Quest.As <Stain>("Stain{Reward}[0]", 0); groups.Add( new QuestRewardItemGroup( new[] { new QuestRewardItem(mItem, mCount, mStain, false) }, QuestRewardGroupType.GenderSpecificMale, null)); } { Item fItem = Quest.As <Item>("Item{Reward}[0]", 1); int fCount = Quest.AsInt32("ItemCount{Reward}[0]", 1); Stain fStain = Quest.As <Stain>("Stain{Reward}[0]", 1); groups.Add( new QuestRewardItemGroup( new[] { new QuestRewardItem(fItem, fCount, fStain, false) }, QuestRewardGroupType.GenderSpecificFemale, null)); } } else if (groupsType == 6) { groups.AddRange(BuildClassQuestJobRewardItemGroups("Item{Reward}[0]", Group1Count)); groups.Add(BuildItemGroup(t2, "Item{Reward}[1]", "ItemCount{Reward}[1]", "Stain{Reward}[1]", "IsHQ{Reward}[1]", Group2Count)); } else if (groupsType == 7) { XivRow beastRankBonus = (XivRow)Quest.BeastTribe["BeastRankBonus"]; Item item = beastRankBonus.As <Item>(); List <int> counts = new List <int>(); for (int i = 0; i < 8; i++) { counts.Add(beastRankBonus.AsInt32("Item{Quantity}", i)); } groups.Add(new QuestRewardItemGroup(new[] { new QuestRewardItem(item, counts.Distinct(), null, false) }, QuestRewardGroupType.BeastRankBonus, null)); } else { groups.Add(BuildItemGroup(t1, "Item{Reward}[0]", "ItemCount{Reward}[0]", "Stain{Reward}[0]", null, Group1Count)); groups.Add(BuildItemGroup(t2, "Item{Reward}[1]", "ItemCount{Reward}[1]", "Stain{Reward}[1]", "IsHQ{Reward}[1]", Group2Count)); } return(groups.Where(g => g.Items.Any()).ToArray()); }
private QuestRewardItemGroup[] BuildItems() { const int CatalystCount = 3; const int Group1Count = 6; const int Group2Count = 5; var groupsType = Quest.AsInt32("ItemRewardType"); var t1 = QuestRewardGroupType.Unknown; var t2 = QuestRewardGroupType.Unknown; switch (groupsType) { case 0: return(new QuestRewardItemGroup[0]); case 1: t1 = QuestRewardGroupType.All; t2 = QuestRewardGroupType.One; break; case 3: // Gender-specific rewards. case 7: // Beast rank bonuses. // Special handler break; case 5: t1 = QuestRewardGroupType.OnePerDay; t2 = QuestRewardGroupType.OnePerDay; break; case 6: // Relic quests break; } var groups = new List <QuestRewardItemGroup>(); var catalysts = BuildItemGroup(QuestRewardGroupType.All, "Item{Catalyst}", "ItemCount{Catalyst}", null, null, CatalystCount); groups.Add(catalysts); var tomestoneRewardIndex = Quest.AsInt32("Tomestone{Reward}"); var tomestoneCount = Quest.AsInt32("TomestoneCount{Reward}"); if (tomestoneRewardIndex != 0 && tomestoneCount > 0) { var tomestoneItems = Quest.Sheet.Collection.GetSheet <TomestonesItem>(); var tomestone = tomestoneItems.FirstOrDefault(t => t.RewardIndex == tomestoneRewardIndex); if (tomestone != null) { groups.Add( new QuestRewardItemGroup( new[] { new QuestRewardItem(tomestone.Item, tomestoneCount, null, false) }, QuestRewardGroupType.All)); } } if (groupsType == 3) { { var mItem = Quest.As <Item>("Item{Reward}[0]", 0); var mCount = Quest.AsInt32("ItemCount{Reward}[0]", 0); var mStain = Quest.As <Stain>("Stain{Reward}[0]", 0); groups.Add( new QuestRewardItemGroup( new[] { new QuestRewardItem(mItem, mCount, mStain, false) }, QuestRewardGroupType.GenderSpecificMale)); } { var fItem = Quest.As <Item>("Item{Reward}[0]", 1); var fCount = Quest.AsInt32("ItemCount{Reward}[0]", 1); var fStain = Quest.As <Stain>("Stain{Reward}[0]", 1); groups.Add( new QuestRewardItemGroup( new[] { new QuestRewardItem(fItem, fCount, fStain, false) }, QuestRewardGroupType.GenderSpecificFemale)); } } else if (groupsType == 7) { var beastRankBonus = (XivRow)Quest.BeastTribe["BeastRankBonus"]; var item = beastRankBonus.As <Item>(); var counts = new List <int>(); for (var i = 0; i < 8; i++) { counts.Add(beastRankBonus.AsInt32("Item{Quantity}", i)); } groups.Add(new QuestRewardItemGroup(new[] { new QuestRewardItem(item, counts.Distinct(), null, false) }, QuestRewardGroupType.BeastRankBonus)); } else { groups.Add(BuildItemGroup(t1, "Item{Reward}[0]", "ItemCount{Reward}[0]", "Stain{Reward}[0]", null, Group1Count)); groups.Add(BuildItemGroup(t2, "Item{Reward}[1]", "ItemCount{Reward}[1]", "Stain{Reward}[1]", "IsHQ{Reward}[1]", Group2Count)); } return(groups.Where(g => g.Items.Any()).ToArray()); }