Skip to content

Instantly share code, notes, and snippets.

@ScottLilly
Last active April 5, 2018 15:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ScottLilly/fce984e543e19eea5984ef300caa8410 to your computer and use it in GitHub Desktop.
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