示例#1
0
        private void RewardQuest(QuestInfo info, ushort reward)
        {
            if (reward != 0)
            {
                if (!info.Rewards.TryGetValue(reward, out Quest2RewardEntry entry))
                {
                    throw new QuestException($"Player {player.CharacterId} tried to complete quest {info.Entry.Id} with invalid reward!");
                }

                // TODO: make sure reward is valid for player, some rewards are conditional

                RewardQuest(entry);
            }

            // TODO: fixed rewards

            uint experience = info.GetRewardExperience();

            if (experience != 0u)
            {
                player.GrantXp(experience, ExpReason.Quest);
            }

            uint money = info.GetRewardMoney();

            if (money != 0u)
            {
                player.CurrencyManager.CurrencyAddAmount(CurrencyType.Credits, money);
            }
        }