Ejemplo n.º 1
0
        private async Task LoadQuestRewards()
        {
            JObject allQuestRewards = await GetAsync(_questRewardsUrl);

            foreach (var child in allQuestRewards["cargoquery"])
            {
                string   questName = child["title"]["quest"].ToString();
                string   reward    = child["title"]["reward"].ToString();
                string   act       = child["title"]["act"].ToString();
                string[] classes   = child["title"]["classes"].ToString().Replace("�", "\\").Split('\\');

                List <string> classesList = new List <string>();
                classesList = classes.ToList();

                if (_allQuestRewards.ContainsKey(questName))
                {
                    _allQuestRewards[questName].RewardsPerClasses.Add(reward, classesList);
                }
                else
                {
                    QuestRewards questRewards = new QuestRewards();
                    questRewards.Name = questName;
                    questRewards.RewardsPerClasses.Add(reward, classesList);
                    questRewards.Act = act;
                    _allQuestRewards.Add(questName, questRewards);
                }
            }
        }
        public bool Equals(DestinyMilestoneQuestDefinition input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     QuestItemHash == input.QuestItemHash ||
                     (QuestItemHash.Equals(input.QuestItemHash))
                     ) &&
                 (
                     DisplayProperties == input.DisplayProperties ||
                     (DisplayProperties != null && DisplayProperties.Equals(input.DisplayProperties))
                 ) &&
                 (
                     OverrideImage == input.OverrideImage ||
                     (OverrideImage != null && OverrideImage.Equals(input.OverrideImage))
                 ) &&
                 (
                     QuestRewards == input.QuestRewards ||
                     (QuestRewards != null && QuestRewards.Equals(input.QuestRewards))
                 ) &&
                 (
                     Activities == input.Activities ||
                     (Activities != null && Activities.SequenceEqual(input.Activities))
                 ) &&
                 (
                     DestinationHash == input.DestinationHash ||
                     (DestinationHash.Equals(input.DestinationHash))
                 ));
        }
Ejemplo n.º 3
0
 private void QuestClicked(object sender, ItemClickEventArgs e)
 {
     if (e.ClickedItem != null && e.ClickedItem is QuestRewards)
     {
         QuestRewards qr = (QuestRewards)e.ClickedItem;
         Frame.Navigate(typeof(QuestDetailsPage), (int)qr.quest_id);
     }
 }
 public bool DeepEquals(DestinyMilestoneQuestDefinition?other)
 {
     return(other is not null &&
            QuestItemHash == other.QuestItemHash &&
            (DisplayProperties is not null ? DisplayProperties.DeepEquals(other.DisplayProperties) : other.DisplayProperties is null) &&
            OverrideImage == other.OverrideImage &&
            (QuestRewards is not null ? QuestRewards.DeepEquals(other.QuestRewards) : other.QuestRewards is null) &&
            Activities.DeepEqualsDictionary(other.Activities) &&
            DestinationHash == other.DestinationHash);
 }
 public bool DeepEquals(MilestoneQuest other)
 {
     return(other != null &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            QuestItem.DeepEquals(other.QuestItem) &&
            QuestRewards.DeepEquals(other.QuestRewards) &&
            OverrideImage == other.OverrideImage &&
            Destination.DeepEquals(other.Destination) &&
            Activities.DeepEqualsReadOnlyDictionaryWithDefinitionKeyAndSimpleValue(other.Activities));
 }
Ejemplo n.º 6
0
        private QuestRewards FindQuestByReward(string reward)
        {
            foreach (var entry in _allQuestRewards)
            {
                QuestRewards qr          = entry.Value;
                var          rewardFound = qr.RewardsPerClasses.Where(x => x.Key == reward);
                if (rewardFound.Count() >= 1)
                {
                    return(qr);
                }
            }

            return(null);
        }
Ejemplo n.º 7
0
        public void BuildQuestRewards(QuestRewards rewards, Player player)
        {
            rewards.ChoiceItemCount = GetRewChoiceItemsCount();
            rewards.ItemCount       = GetRewItemsCount();
            rewards.Money           = player.GetQuestMoneyReward(this);
            rewards.XP = player.GetQuestXPReward(this);
            rewards.ArtifactCategoryID = RewardArtifactCategoryID;
            rewards.Title        = RewardTitleId;
            rewards.FactionFlags = RewardReputationMask;
            for (int i = 0; i < SharedConst.QuestRewardDisplaySpellCount; ++i)
            {
                rewards.SpellCompletionDisplayID[i] = (int)RewardDisplaySpell[i];
            }

            rewards.SpellCompletionID = RewardSpell;
            rewards.SkillLineID       = RewardSkillId;
            rewards.NumSkillUps       = RewardSkillPoints;
            rewards.TreasurePickerID  = (uint)TreasurePickerID;

            for (int i = 0; i < SharedConst.QuestRewardChoicesCount; ++i)
            {
                rewards.ChoiceItems[i].Item        = new ItemInstance();
                rewards.ChoiceItems[i].Item.ItemID = RewardChoiceItemId[i];
                rewards.ChoiceItems[i].Quantity    = RewardChoiceItemCount[i];
            }

            for (int i = 0; i < SharedConst.QuestRewardItemCount; ++i)
            {
                rewards.ItemID[i]  = RewardItemId[i];
                rewards.ItemQty[i] = RewardItemCount[i];
            }

            for (int i = 0; i < SharedConst.QuestRewardReputationsCount; ++i)
            {
                rewards.FactionID[i]       = RewardFactionId[i];
                rewards.FactionOverride[i] = RewardFactionOverride[i];
                rewards.FactionValue[i]    = RewardFactionValue[i];
                rewards.FactionCapIn[i]    = (int)RewardFactionCapIn[i];
            }

            for (int i = 0; i < SharedConst.QuestRewardCurrencyCount; ++i)
            {
                rewards.CurrencyID[i]  = RewardCurrencyId[i];
                rewards.CurrencyQty[i] = RewardCurrencyCount[i];
            }
        }
Ejemplo n.º 8
0
        //testing non async method
        public async void LoadSkillGems()
        {
            AllSkillGems.Clear();
            JObject allGems = await GetAsync(_skillsUrl);


            foreach (var child in allGems["cargoquery"])
            {
                string   gemname = child["title"]["name"].ToString();
                SkillGem gem     = new SkillGem();
                gem.Name          = child["title"]["name"].ToString();
                gem.Attribute     = child["title"]["primary attribute"].ToString();
                gem.RequiredLevel = child["title"]["required level"].ToString();
                QuestRewards qr = FindQuestByReward(gemname);
                gem.QuestRewards      = qr;
                gem.VendorRewardsList = FindRewardsByGem(gem.Name);
                AllSkillGems.Add(gem);
            }
        }
 public void Update(DestinyMilestoneQuestDefinition?other)
 {
     if (other is null)
     {
         return;
     }
     if (QuestItemHash != other.QuestItemHash)
     {
         QuestItemHash = other.QuestItemHash;
         OnPropertyChanged(nameof(QuestItemHash));
     }
     if (!DisplayProperties.DeepEquals(other.DisplayProperties))
     {
         DisplayProperties.Update(other.DisplayProperties);
         OnPropertyChanged(nameof(DisplayProperties));
     }
     if (OverrideImage != other.OverrideImage)
     {
         OverrideImage = other.OverrideImage;
         OnPropertyChanged(nameof(OverrideImage));
     }
     if (!QuestRewards.DeepEquals(other.QuestRewards))
     {
         QuestRewards.Update(other.QuestRewards);
         OnPropertyChanged(nameof(QuestRewards));
     }
     if (!Activities.DeepEqualsDictionary(other.Activities))
     {
         Activities = other.Activities;
         OnPropertyChanged(nameof(Activities));
     }
     if (DestinationHash != other.DestinationHash)
     {
         DestinationHash = other.DestinationHash;
         OnPropertyChanged(nameof(DestinationHash));
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Constructs a new RewardQuest from a database Object
 /// </summary>
 /// <param name="questingPlayer">The player doing the quest</param>
 /// <param name="dbQuest">The database object</param>
 public RewardQuest(GamePlayer questingPlayer, DBQuest dbQuest)
     : base(questingPlayer, dbQuest)
 {
     m_rewards = new QuestRewards(this);
     m_goals = new List<QuestGoal>();
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructs a new RewardQuest.
 /// </summary>
 /// <param name="questingPlayer">The player doing this quest</param>
 /// <param name="step">The current step the player is on</param>
 public RewardQuest(GamePlayer questingPlayer, int step)
     : base(questingPlayer, step)
 {
     m_rewards = new QuestRewards(this);
     m_goals = new List<QuestGoal>();
 }
Ejemplo n.º 12
0
 public RewardQuest()
     : base()
 {
     m_rewards = new QuestRewards(this);
     m_goals = new List<QuestGoal>();
 }
Ejemplo n.º 13
0
        public string GetRewardPacket(Character character, bool onlyItems = false)
        {
            if (!QuestRewards.Any() || onlyItems && !QuestRewards.Any(s => (QuestRewardType)s.RewardType == QuestRewardType.WearItem || (QuestRewardType)s.RewardType == QuestRewardType.EtcMainItem))
            {
                return("");
            }

            return($"qr {GetRewardPacket()} {InfoId}");

            string GetRewardPacket()
            {
                string str = "";

                for (int a = 0; a < 4; a++)
                {
                    QuestRewardDTO reward = QuestRewards.Skip(a).FirstOrDefault();
                    if (reward == null || onlyItems && (QuestRewardType)reward.RewardType != QuestRewardType.WearItem && (QuestRewardType)reward.RewardType != QuestRewardType.EtcMainItem)
                    {
                        str += "0 0 0 ";
                        continue;
                    }
                    switch ((QuestRewardType)reward.RewardType)
                    {
                    // Item
                    case QuestRewardType.WearItem:
                    case QuestRewardType.EtcMainItem:
                        byte amount = (byte)(reward.Amount == 0 ? 1 : reward.Amount);
                        if (reward.Data == 1917 && character.IsMorphed)
                        {
                            amount *= 2;
                        }
                        character.GiftAdd((short)reward.Data, amount, reward.Rarity, reward.Upgrade, reward.Design, false);
                        str += $"{reward.RewardType} {reward.Data} {amount} ";
                        break;

                    // Gold
                    case QuestRewardType.Gold:
                    case QuestRewardType.SecondGold:
                    case QuestRewardType.ThirdGold:
                    case QuestRewardType.FourthGold:
                        character.GetGold(reward.Amount, true);
                        str += $"{reward.RewardType} 0 {(reward.Amount == 0 ? 1 : reward.Amount)} ";
                        break;

                    case QuestRewardType.Reput:     // Reputation
                        character.GetReputation(reward.Amount);
                        str += $"{reward.RewardType} 0 0";
                        break;

                    case QuestRewardType.Exp:     // Experience
                        if (character.Level < ServerManager.Instance.Configuration.MaxLevel)
                        {
                            character.GetXp((long)(CharacterHelper.XPData[reward.Data > 255 ? 255 : reward.Data] * reward.Amount / 100D));
                        }
                        str += $"{reward.RewardType} 0 0 ";
                        break;

                    case QuestRewardType.SecondExp:     // % Experience
                        if (character.Level < ServerManager.Instance.Configuration.MaxLevel)
                        {
                            character.GetXp((long)(CharacterHelper.XPData[character.Level] * reward.Amount / 100D));
                        }
                        str += $"{reward.RewardType} 0 0 ";
                        break;

                    case QuestRewardType.JobExp:     // JobExperience
                        character.GetJobExp((long)((character.Class == (byte)ClassType.Adventurer ? CharacterHelper.FirstJobXPData[reward.Data > 255 ? 255 : reward.Data] : CharacterHelper.SecondJobXPData[reward.Data > 255 ? 255 : reward.Data]) * reward.Amount / 100D));
                        str += $"{reward.RewardType} 0 0 ";
                        break;

                    case QuestRewardType.SecondJobExp:     // % JobExperience
                        character.GetJobExp((long)((character.Class == (byte)ClassType.Adventurer ? CharacterHelper.FirstJobXPData[character.JobLevel] : CharacterHelper.SecondJobXPData[character.JobLevel]) * reward.Amount / 100D));
                        str += $"{reward.RewardType} 0 0 ";
                        break;

                    default:
                        str += "0 0 0 ";
                        break;
                    }
                }
                return(str);
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Constructs a new RewardQuest from a database Object
 /// </summary>
 /// <param name="questingPlayer">The player doing the quest</param>
 /// <param name="dbQuest">The database object</param>
 public RewardQuest(GamePlayer questingPlayer, DBQuest dbQuest)
     : base(questingPlayer, dbQuest)
 {
     Rewards = new QuestRewards(this);
     Goals   = new List <QuestGoal>();
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Constructs a new RewardQuest.
 /// </summary>
 /// <param name="questingPlayer">The player doing this quest</param>
 /// <param name="step">The current step the player is on</param>
 public RewardQuest(GamePlayer questingPlayer, int step)
     : base(questingPlayer, step)
 {
     Rewards = new QuestRewards(this);
     Goals   = new List <QuestGoal>();
 }
Ejemplo n.º 16
0
 public RewardQuest()
 {
     Rewards = new QuestRewards(this);
     Goals   = new List <QuestGoal>();
 }
Ejemplo n.º 17
0
 //任务完成是物品奖励处理
 public void SetTaskReward(QuestRewards _questRewards)
 {
     GetExp(_questRewards.experience);
     inventory.GetItems(_questRewards.Equip);
 }
Ejemplo n.º 18
0
        public void BuildQuestRewards(QuestRewards rewards, Player player)
        {
            rewards.ChoiceItemCount = GetRewChoiceItemsCount();
            rewards.ItemCount       = GetRewItemsCount();
            rewards.Money           = player.GetQuestMoneyReward(this);
            rewards.XP = player.GetQuestXPReward(this);
            rewards.ArtifactCategoryID = RewardArtifactCategoryID;
            rewards.Title        = RewardTitleId;
            rewards.FactionFlags = RewardReputationMask;

            var displaySpellIndex = 0;

            foreach (QuestRewardDisplaySpell displaySpell in RewardDisplaySpell)
            {
                PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(displaySpell.PlayerConditionId);
                if (playerCondition != null)
                {
                    if (!ConditionManager.IsPlayerMeetingCondition(player, playerCondition))
                    {
                        continue;
                    }
                }

                rewards.SpellCompletionDisplayID[displaySpellIndex] = (int)displaySpell.SpellId;
                if (++displaySpellIndex >= rewards.SpellCompletionDisplayID.Length)
                {
                    break;
                }
            }

            rewards.SpellCompletionID = RewardSpell;
            rewards.SkillLineID       = RewardSkillId;
            rewards.NumSkillUps       = RewardSkillPoints;
            rewards.TreasurePickerID  = (uint)TreasurePickerID;

            for (int i = 0; i < SharedConst.QuestRewardChoicesCount; ++i)
            {
                rewards.ChoiceItems[i].LootItemType = RewardChoiceItemType[i];
                rewards.ChoiceItems[i].Item         = new ItemInstance();
                rewards.ChoiceItems[i].Item.ItemID  = RewardChoiceItemId[i];
                rewards.ChoiceItems[i].Quantity     = RewardChoiceItemCount[i];
            }

            for (int i = 0; i < SharedConst.QuestRewardItemCount; ++i)
            {
                rewards.ItemID[i]  = RewardItemId[i];
                rewards.ItemQty[i] = RewardItemCount[i];
            }

            for (int i = 0; i < SharedConst.QuestRewardReputationsCount; ++i)
            {
                rewards.FactionID[i]       = RewardFactionId[i];
                rewards.FactionOverride[i] = RewardFactionOverride[i];
                rewards.FactionValue[i]    = RewardFactionValue[i];
                rewards.FactionCapIn[i]    = RewardFactionCapIn[i];
            }

            for (int i = 0; i < SharedConst.QuestRewardCurrencyCount; ++i)
            {
                rewards.CurrencyID[i]  = RewardCurrencyId[i];
                rewards.CurrencyQty[i] = RewardCurrencyCount[i];
            }
        }
Ejemplo n.º 19
0
 public RewardQuest() : base()
 {
     m_rewards = new QuestRewards(this);
     m_goals   = new List <QuestGoal>();
 }