public static Quest GenerateRandomQuest() { Quest quest = new Quest(); questItemReq itemReqs = new questItemReq(true); quest.questGoals.Add(itemReqs); quest.questID = nextQuestID; quest.questDescription = QuestDescription(itemReqs, quest); quest.characterQuestIntroduction = quest.questDescription; //This should be changed //Debug.Log(quest.questID); NextQuestID -= 1; //Iterate to make sure that the same quest ID isn't reused JSONserializer json = new JSONserializer(); json.SaveFile(quest); return(quest); }
static string QuestDescription(questItemReq questReq, Quest quest) //Test: generates character text based on quest requiements { Debug.Log(quest.questID); string description = "Bring me <color=blue>"; for (int i = 0; i < questReq.items.Count; i++) { if (i > 0) { if (i == questReq.items.Count - 1) { description += "</color>, and <color=blue>"; } else { description += "</color>, <color=blue>"; } } description += questReq.items[i]._amount + "x " + questReq.items[i].GetItemName(); } description += $"</color>, and I will reward you. \n <link=/GetQuest {quest.questID}>Accept</link>"; return(description); }