Instantly share code, notes, and snippets.

@ScottLilly /SuperAdventure.cs Secret
Last active Apr 5, 2018

Embed
What would you like to do?
SuperAdvQuest fixes
// Code to add here
foreach (PlayerQuest playerQuest in _player.Quests)
{
if (playerQuest.Details.CompletionLocationID == newLocation.ID)
{
if (!_player.CompletedThisQuest(playerQuest.Quest))
{
// See if the player has all the items needed to complete the quest
bool playerHasAllItemsToCompleteQuestTest = _player.HasAllQuestCompletionItems(playerQuest.Quest);
if (playerHasAllItemsToCompleteQuestTest)
{
// Display message
rtbMessages.Text += Environment.NewLine;
rtbMessages.Text += "You complete the '" + playerQuest.Quest.Name + "' quest." + Environment.NewLine;
// Remove quest items from inventory
_player.RemoveQuestCompletionItems(playerQuest.Quest);
// Give quest rewards
rtbMessages.Text += "You receive: " + Environment.NewLine;
rtbMessages.Text += playerQuest.Quest.RewardExperiencePoints.ToString() + " experience points" + Environment.NewLine;
rtbMessages.Text += playerQuest.Quest.RewardGold.ToString() + " gold" + Environment.NewLine;
rtbMessages.Text += playerQuest.Quest.RewardItem.Name + Environment.NewLine;
rtbMessages.Text += Environment.NewLine;
_player.ExperiencePoints += playerQuest.Quest.RewardExperiencePoints;
_player.Gold += playerQuest.Quest.RewardGold;
// Add the reward item to the player's inventory
_player.AddItemToInventory(playerQuest.Quest.RewardItem);
// Mark the quest as completed
_player.MarkQuestCompleted(playerQuest.Quest);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment