Ejemplo n.º 1
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)
            {
                bool foundItemInPlayersInventory = false;

                // Check each item in the player's inventory, to see if they have it, and enough of it
                foreach(InventoryItem ii in Inventory)
                {
                    if(ii.Details.ID == qci.Details.ID) // The player has the item in their inventory
                    {
                        foundItemInPlayersInventory = true;

                        if(ii.Quantity < qci.Quantity) // The player does not have enough of this item to complete the quest
                        {
                            return false;
                        }
                    }
                }

                // The player does not have any of this quest completion item in their inventory
                if(!foundItemInPlayersInventory)
                {
                    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;
        }
Ejemplo n.º 2
0
 //construct the damn thing the way that i want
 public Location(int id, string name, string description, Item itemRequiredToEnter = null, Quest questAvailableHere = null, Monster monsterLivingHere = null) {
     ID = id;
     Name = name;
     Description = description;
     ItemRequiredToEnter = itemRequiredToEnter;
     QuestAvailableHere = questAvailableHere;
     MonsterLivingHere = monsterLivingHere;
 }
Ejemplo n.º 3
0
 public Location(int ID, string name, string description, Item itemRequiredToEnter = null, Quest questAvailableHere = null, Monster monsterLivingHere = null)
 {
     this.ID = ID;
     this.name = name;
     this.description = description;
     this.itemRequiredToEnter = itemRequiredToEnter;
     this.questAvailableHere = questAvailableHere;
     this.monsterLivingHere = monsterLivingHere;
 }
Ejemplo n.º 4
0
 public Location(int id, string name, string description, Item itemrequred = null, Quest questAvailHere = null, Monster monstersHere = null)
 {
     Index = id;
     Name = name;
     Description = description;
     ItemRequiredToEnter = itemrequred;
     QuestAvailableHere = questAvailHere;
     MonstersHere = monstersHere;
 }
Ejemplo n.º 5
0
 public Location(int id, string name, string desc, Item itemrequiredtoenter = null, 
                 Quest questavailableHere = null, Mobs monsterlivinghere= null)
 {
     ID = id;
     Name = name;
     Desc = desc;
     QuestAvailableHere = questavailableHere;
     Itemrequiredtoenter = itemrequiredtoenter;
     Monsterlivinghere = monsterlivinghere;
 }
Ejemplo n.º 6
0
 public Location(int ID, string Name, string Description, Item ItemRequiredToEnter = null, Quest QuestAvailableHere = null,
     Monster MonsterLivingHere = null)
 {
     this.ID = ID;
     this.Name = Name;
     this.Description = Description;
     this.ItemRequiredToEnter = ItemRequiredToEnter;
     this.QuestAvailableHere = QuestAvailableHere;
     this.MonsterLivingHere = MonsterLivingHere;
 }
Ejemplo n.º 7
0
 public Item(int id, string name, string namePlural, Item itemRequiredToEnter = null, Quest questAvailableHere = null,
     Monster monsterLivingHere = null)
 {
     ID = id;
     Name = name;
     NamePlural = namePlural;
     ItemRequiredToEnter = itemRequiredToEnter;
     QuestAvailableHere = questAvailableHere;
     MonsterLivingHere = monsterLivingHere;
 }
Ejemplo n.º 8
0
 public bool CompletedThisQuest(Quest quest)
 {
     foreach (PlayerQuest playerQuest in Quests)
        {
        if (playerQuest.Details.ID == quest.ID)
        {
            return playerQuest.IsCompleted;
        }
        }
        return false;
 }
Ejemplo n.º 9
0
        public bool HasThisQuest(Quest quest)
        {
            foreach(PlayerQuest playerQuest in Quests)
            {
                if(playerQuest.Details.ID == quest.ID)
                {
                    return true;
                }
            }

            return false;
        }
Ejemplo n.º 10
0
 public bool CompletedThisQuest(Quest quest)
 {
     foreach (PlayerQuest playerquest in Quests)
         if (playerquest.Details.Index == quest.Index)
             return playerquest.IsComplete;
     return false;
 }
Ejemplo n.º 11
0
        public bool HasAllQuestCompletionItems(Quest quest)
        {
            foreach(QuestCompletionItem qci in quest.QuestCompletionItems)
            {
                if(!Inventory.Any(ii => ii.Details.ID == qci.Details.ID && ii.Quantity >= qci.Quantity))
                {
                    return false;
                }
            }

            return true;
        }
Ejemplo n.º 12
0
        private static void PopulateQuests()
        {
            Quest clearAlchemistGarden =
                new Quest(
                    QUEST_ID_CLEAR_ALCHEMIST_GARDEN,
                    "Clear the alchemist's garden",
                    "  - Kill rats in the alchemist's garden and bring back 3 rat tails.\n  - You will receive a healing potion and 10 gold pieces.\n", 20, 10);

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

            clearAlchemistGarden.RewardItem = ItemByID(ITEM_ID_HEALING_POTION);

            Quest clearFarmersField =
                new Quest(
                    QUEST_ID_CLEAR_FARMERS_FIELD,
                    "Clear the farmer's field",
                    "Kill snakes in the farmer's field and bring back 3 snake fangs.\nYou will receive an adventurer's pass and 20 gold pieces.", 20, 20);

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

            clearFarmersField.RewardItem = ItemByID(ITEM_ID_ADVENTURER_PASS);

            Quests.Add(clearAlchemistGarden);
            Quests.Add(clearFarmersField);
        }
Ejemplo n.º 13
0
 public PlayerQuest(Quest questDetails, bool isCompleted = false)
 {
     QuestDetails = questDetails;
     IsCompleted  = isCompleted;
 }
Ejemplo n.º 14
0
 public PlayerQuest(Quest details)
 {
     Details = details;
     IsCompleted = false;
 }
Ejemplo n.º 15
0
        private static void PopulateQuests()
        {
            Quest clearAlchemistGarden =
                new Quest(
                    QUEST_ID_CLEAR_ALCHEMIST_GARDEN,
                    Resources.Text.resAlchemistGarden, Resources.Text.resAlchemistGardenInfo, 20, 10);

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

            clearAlchemistGarden.RewardItem = ItemByID(ITEM_ID_HEALING_POTION);

            Quest clearFarmersField =
                new Quest(
                    QUEST_ID_CLEAR_FARMERS_FIELD,
                    Resources.Text.resFarmerField, Resources.Text.resFarmerFieldInfo, 20, 20);

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

            clearFarmersField.RewardItem = ItemByID(ITEM_ID_ADVENTURER_PASS);

            Quests.Add(clearAlchemistGarden);
            Quests.Add(clearFarmersField);
        }
Ejemplo n.º 16
0
        public void MarkQuestCompleted(Quest quest)
        {
            PlayerQuest playerQuest = Quests.SingleOrDefault(pq => pq.Details.ID == quest.ID);

            if(playerQuest != null)
            {
                playerQuest.IsCompleted = true;
            }
        }
Ejemplo n.º 17
0
 public void RemoveQuestCompletionItems(Quest quest)
 {
     foreach (QuestCompletionItem qci in quest.QuestCompletionItems)
     {
         foreach (InventoryItem ii in Inventory)
         {
             if (ii.Details.ID == qci.Details.ID)
             {
                 // Subtract the quantity from the player's inventory that was needed to complete the quest
                 ii.Quantity -= qci.Quantity;
                 break;
             }
         }
     }
 }
Ejemplo n.º 18
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;
                    break;
                }
            }
        }
Ejemplo n.º 19
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;
            }
        }
Ejemplo n.º 20
0
 public bool HasThisQuest(Quest quest)
 {
     return Quests.Exists(pq => pq.Details.ID == quest.ID);
 }
Ejemplo n.º 21
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;
        }
Ejemplo n.º 22
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)
                {
                    RemoveItemFromInventory(item.Details,qci.Quantity);
                }
            }
        }
Ejemplo n.º 23
0
        public void MarkQuestCompleted(Quest quest)
        {
            // Find the quest in the player's quest list
            foreach (PlayerQuest pq in Quests)
            {
                if (pq.Details.ID == quest.ID)
                {
                    // Mark it as completed
                    pq.IsCompleted = true;

                    return; // We found the quest, and marked it complete, so get out of this function
                }
            }
        }
Ejemplo n.º 24
0
        public bool HasAllQuestItem(Quest quest)
        {
            foreach (QuestCompleted qci in quest.QuestCompleted)
            {
                bool foundItemInInventory = false;

                foreach (Inventory ii in Inventory)
                    if (ii.Details.Index == qci.Details.Index)
                    {
                        foundItemInInventory = true;
                        if (ii.Quantity < qci.Quantity)
                            return false;
                    }
                if (!foundItemInInventory)
                    return false;
            }
            return true;
        }
Ejemplo n.º 25
0
 public PlayerQuest(Quest details, bool isCompleted)
 {
     Details = details;
     IsCompleted = isCompleted;
 }
Ejemplo n.º 26
0
 public bool HasThisQuest(Quest quest)
 {
     foreach(PlayerQuest playerQuest in Quests)
         if (playerQuest.Details.Index == quest.Index)
             return true;
     return false;
 }
Ejemplo n.º 27
0
 public void MarkQuestComplete(Quest quest)
 {
     foreach (PlayerQuest pq in Quests)
         if (pq.Details.Index == quest.Index)
         {
             pq.IsComplete = true;
             return;
         }
 }
Ejemplo n.º 28
0
 public void RemoveQuestCompletedItem(Quest quest)
 {
     foreach(QuestCompleted qci in quest.QuestCompleted)
         foreach(Inventory ii in Inventory)
             if (ii.Details.Index == qci.Details.Index)
             {
                 ii.Quantity -= qci.Quantity;
                 break;
             }
 }
Ejemplo n.º 29
0
 public PlayerQuest(Quest details)
 {
     this.details = details;
     isCompleted = false;
 }
Ejemplo n.º 30
0
        private static void PopulateQuests()
        {
            Quest clearAlchemistGarden =
                new Quest(
                    QUEST_ID_CLEAR_ALCHEMIST_GARDEN,
                    "Clear the alchemist's garden",
                    "Kill rats in the alchemist's garden and bring back 3 rat tails. You will receive a healing potion and 10 gold pieces.", 20, 10);

            clearAlchemistGarden.QuestCompletionItems.Add(new QuestCompletionItem(ItemByID(ITEM_ID_RAT_TAIL), 3));
            clearAlchemistGarden.RewardItem = ItemByID(ITEM_ID_HEALING_POTION);

            Quest clearFarmersField =
                new Quest(
                    QUEST_ID_CLEAR_FARMERS_FIELD,
                    "Clear the farmer's field",
                    "Kill snakes in the farmer's field and bring back 3 snake fangs. You will receive an adventurer's pass, a club, and 20 gold pieces.", 40, 20);

            clearFarmersField.QuestCompletionItems.Add(new QuestCompletionItem(ItemByID(ITEM_ID_SNAKE_FANG), 3));
            clearFarmersField.RewardItem = ItemByID(ITEM_ID_ADVENTURER_PASS);

            Quest clearSpiderField =
             new Quest(
                  QUEST_ID_CLEAR_SPIDERFIELD,
                  "Clear the spider infested field",
                  "Kill spiders in the Field and bring back 5 String. You'll receive an explorer's pass and 100 gold pieces.", 100, 100);

            clearSpiderField.QuestCompletionItems.Add(new QuestCompletionItem(ItemByID(ITEM_ID_SPIDER_SILK), 3));
            clearSpiderField.RewardItem = ItemByID(ITEM_ID_EXPLORER_PASS);

            Quest getToMorris =
             new Quest(
                  QUEST_ID_GO_TO_MORRIS,
                  "Get to Morris",
                  "Travel through the forest towards the south", 200, 1);
            getToMorris.QuestCompletionItems.Add(new QuestCompletionItem(ItemByID(ITEM_ID_COMPLETED_TOKEN), 1));
            getToMorris.RewardItem = ItemByID(ITEM_ID_HEALING_POTION);

            Quests.Add(getToMorris);
            Quests.Add(clearAlchemistGarden);
            Quests.Add(clearFarmersField);
            Quests.Add(clearSpiderField);
        }
Ejemplo n.º 31
0
        private static void PopulateQuests()
        {
            Quest clearAlchGar = new Quest(
                QUEST_INDEX_CLEAR_ALCHEMIST_GARDEN,
                "Clear the Alchemists garden",
                "Kill the rats in the Alchemists garden and bring back 3 rat tails. Quest Reward : Healing Potion",
                20, 10);
            clearAlchGar.QuestCompleted.Add(new QuestCompleted(ItemByID(ITEM_INDEX001), 1));
            clearAlchGar.Reward_ITEM = ItemByID(ITEM_INDEX006);

            Quest clearFarmersField = new Quest(
                QUEST_INDEX_CLEAR_FARMERS_FIELD,
                "Clear the farmers field",
                "Kill the snakes in the farmers field and bring back 3 snake fangs. Quest Reward : Adventure Pass",
                20, 20);
            clearFarmersField.QuestCompleted.Add(new QuestCompleted(ItemByID(ITEM_INDEX003),1));
            clearFarmersField.Reward_ITEM = ItemByID(ITEM_INDEX009);

            Quest clearSpiders = new Quest(
                QUEST_INDEX_CLEAR_SPIDERS,
                "Clear the Spider Forrest",
                "Kill the spiders in the spiders forrest and bring back 3 spiders web. Quest reward : Adventure Pass",
                30, 30);
            clearSpiders.QuestCompleted.Add(new QuestCompleted(ItemByID(ITEM_INDEX008), 1));
            clearSpiders.Reward_ITEM = ItemByID(ITEM_INDEX009);

            Quests.Add(clearAlchGar);
            Quests.Add(clearFarmersField);
            Quests.Add(clearSpiders);
        }
Ejemplo n.º 32
0
 public bool HasThisQuest(Quest quest)
 {
     return(Quests.Any(pq => pq.Details.ID == quest.ID));
 }