private List <QuestRewardItemGroup> BuildClassQuestJobRewardItemGroups(string itemPrefix, int count)
        {
            List <QuestRewardItemGroup> groups = new List <QuestRewardItemGroup>();

            for (int i = 0; i < count; ++i)
            {
                XivRow row = (XivRow)Quest[$"{itemPrefix}[{i}]"];
                if (row == null)
                {
                    continue;
                }

                Ex.Variant2.DataRow parentRow = (SaintCoinach.Ex.Variant2.DataRow)row.SourceRow;
                foreach (Ex.Variant2.SubRow subRow in parentRow.SubRows)
                {
                    ClassJobCategory       category = (ClassJobCategory)subRow["ClassJobCategory"];
                    List <QuestRewardItem> items    = new List <QuestRewardItem>();
                    for (int ii = 0; ii < 3; ++ii)
                    {
                        Item itm = (Item)subRow["Reward{Item}[" + ii + "]"];
                        byte c   = (byte)subRow["Reward{Amount}[" + ii + "]"];
                        if (itm.Key == 0 || c == 0 || category.Key == 0)
                        {
                            continue;
                        }

                        items.Add(new QuestRewardItem(itm, c, null, false));
                    }
                    groups.Add(new QuestRewardItemGroup(items, QuestRewardGroupType.ClassJob, category));
                }
            }

            return(groups);
        }
Exemple #2
0
        Dictionary <Saint.EquipSlot, ModelData> GetModelKeys(Saint.XivRow sNpcEquip, Saint.XivRow sENpcBase)
        {
            var keys = new Dictionary <Saint.EquipSlot, ModelData>();

            // First process the sNpcEquip template.
            if (sNpcEquip != null && sNpcEquip.Key != 0)
            {
                StoreModelKeys(keys, sNpcEquip);
            }

            // Next override with ENpcBase data.
            StoreModelKeys(keys, sENpcBase);

            return(keys);
        }
Exemple #3
0
 void StoreModelKeys(Dictionary <Saint.EquipSlot, ModelData> keys, Saint.XivRow row)
 {
     StoreModelKey(keys, (Saint.Quad)row["Model{MainHand}"], (Saint.Stain)row["Dye{MainHand}"], _slots[0]);
     StoreModelKey(keys, (Saint.Quad)row["Model{OffHand}"], (Saint.Stain)row["Dye{OffHand}"], _slots[1]);
     StoreModelKey(keys, (UInt32)row["Model{Head}"], (Saint.Stain)row["Dye{Head}"], _slots[2]);
     StoreModelKey(keys, (UInt32)row["Model{Body}"], (Saint.Stain)row["Dye{Body}"], _slots[3]);
     StoreModelKey(keys, (UInt32)row["Model{Hands}"], (Saint.Stain)row["Dye{Hands}"], _slots[4]);
     StoreModelKey(keys, (UInt32)row["Model{Legs}"], (Saint.Stain)row["Dye{Legs}"], _slots[6]);
     StoreModelKey(keys, (UInt32)row["Model{Feet}"], (Saint.Stain)row["Dye{Feet}"], _slots[7]);
     StoreModelKey(keys, (UInt32)row["Model{Ears}"], (Saint.Stain)row["Dye{Ears}"], _slots[8]);
     StoreModelKey(keys, (UInt32)row["Model{Neck}"], (Saint.Stain)row["Dye{Neck}"], _slots[9]);
     StoreModelKey(keys, (UInt32)row["Model{Wrists}"], (Saint.Stain)row["Dye{Wrists}"], _slots[10]);
     StoreModelKey(keys, (UInt32)row["Model{LeftRing}"], (Saint.Stain)row["Dye{LeftRing}"], _slots[11]);
     StoreModelKey(keys, (UInt32)row["Model{RightRing}"], (Saint.Stain)row["Dye{RightRing}"], _slots[12]);
 }
Exemple #4
0
        dynamic CalcCollectableExp(Saint.XivRow sCollectablesShopItem)
        {
            // By some verifications, the exp reward is still calculated in
            // the same way as Masterpiece.
            var exps = new int[3];

            // Constrain level by valid range for this collectable.
            var level = Math.Max(Convert.ToInt32(sCollectablesShopItem["LevelMin"]),
                                 Convert.ToInt32(sCollectablesShopItem["LevelMax"]));
            // Find the base XP.
            var paramGrow = _sParamGrow[level];
            var ratio     = ((float)paramGrow.ExpToNext) / 1000;

            var sReward = (Saint.XivRow)sCollectablesShopItem["CollectablesShopRewardScrip"];

            exps[0] = (int)(ratio * Convert.ToInt32(sReward["ExpRatioLow"]));
            exps[1] = (int)(ratio * Convert.ToInt32(sReward["ExpRatioMid"]));
            exps[2] = (int)(ratio * Convert.ToInt32(sReward["ExpRatioHigh"]));

            return(exps);
        }
        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());
        }