Example #1
0
 public NPC(int id, string name,
     int currHP, int maxHP,
     Quest quest, Uri imgUri)
     : base(name, currHP, maxHP, imgUri)
 {
     ID = id;
     Quest = quest;
 }
Example #2
0
        public void RemoveQuestCompletionItems(Quest quest)
        {
            foreach (QuestCompletionItem qci in quest.QuestCompletionItems)
            {
                InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == qci.Details.ID);

                if (item != null)
                {
                    // Subtract the quantity from the player's inventory that was needed to complete the quest
                    item.Quantity -= qci.Quantity;
                    // Remove any items that have 0 quantity
                    Inventory.RemoveAll(x => x.Quantity == 0);
                    break;
                }
            }
        }
Example #3
0
        private static void SpawnQuests()
        {
            Quest clearEastCoast =
                new Quest(
                    QUEST_ID_CLEAR_EAST_COAST,
                    "Clear the East Coast",
                    "Kill rats in the east coast and bring back 3 rat tails. You will receive a club and 10 adena.", 20, 10);

            clearEastCoast.QuestCompletionItems.Add(new QuestCompletionItem(ItemByID(ITEM_ID_RAT_TAIL), 3));

            clearEastCoast.ItemReward = ItemByID(ITEM_ID_CLUB);

            Quest clearWestCoast =
                new Quest(
                    QUEST_ID_CLEAR_WEST_COAST,
                    "Clear the West Coast",
                    "Kill snakes in the west coast and bring back 3 snake fangs. You will receive a silver knife and 20 adena.", 20, 20);

            clearWestCoast.QuestCompletionItems.Add(new QuestCompletionItem(ItemByID(ITEM_ID_SNAKE_FANG), 3));

            clearWestCoast.ItemReward = ItemByID(ITEM_ID_SILVER_KNIFE);

            Quests.Add(clearEastCoast);
            Quests.Add(clearWestCoast);
        }
Example #4
0
        public void MarkQuestCompleted(Quest quest)
        {
            // Find the quest in the player's quest list
            PlayerQuest playerQuest = Quests.SingleOrDefault(pq => pq.Details.ID == quest.ID);

            if (playerQuest != null)
            {
                playerQuest.isCompleted = true;
            }
        }
Example #5
0
 public bool HasThisQuest(Quest quest)
 {
     return Quests.Exists(pq => pq.Details.ID == quest.ID);
 }
Example #6
0
        public bool HasAllQuestCompletionItems(Quest quest)
        {
            // See if the player has all the items needed to complete the quest here
            foreach (QuestCompletionItem qci in quest.QuestCompletionItems)
            {
                // Check each item in the player's inventory, to see if they have it, and enough of it
                if (!Inventory.Exists(ii => ii.Details.ID == qci.Details.ID && ii.Quantity >= qci.Quantity))
                {
                    return false;
                }
            }

            // If we got here, then the player must have all the required items, and enough of them, to complete the quest.
            return true;
        }
Example #7
0
        public bool CompletedThisQuest(Quest quest)
        {
            foreach (PlayerQuest playerQuest in Quests)
            {
                if (playerQuest.Details.ID == quest.ID)
                {
                    return playerQuest.isCompleted;
                }
            }

            return false;
        }
Example #8
0
 public PlayerQuest(Quest details)
 {
     Details = details;
     isCompleted = false;
 }