Ejemplo n.º 1
0
        public void CraftItemUsing(Recipe recipe)
        {
            if (CurrentPlayer.HasAllTheseItems(recipe.Ingredients))
            {
                CurrentPlayer.RemoveItemsFromInventory(recipe.Ingredients);

                foreach (ItemQuantity itemQuantity in recipe.OutputItems)
                {
                    for (int i = 0; i < itemQuantity.Quantity; i++)
                    {
                        GameItem outputItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);
                        CurrentPlayer.AddItemToInventory(outputItem);
                        RaiseMessage(Emote.HAPPY, $"You craft 1 {outputItem.Name}");
                    }
                }
            }
            else
            {
                RaiseMessage(Emote.MOCKING, "You do not have the required ingredients:");
                foreach (ItemQuantity itemQuantity in recipe.Ingredients)
                {
                    RaiseMessage(Emote.MOCKING, $"  {itemQuantity.Quantity} {ItemFactory.ItemName(itemQuantity.ItemID)}");
                }
            }
        }
Ejemplo n.º 2
0
 public void CraftItemUsing(Scheme scheme)
 {
     if (CurrentPlayer.Inventory.HasAllThisItems(scheme.RequiredItems))
     {
         CurrentPlayer.RemoveItemsFromInventory(scheme.RequiredItems);
         foreach (var item in scheme.QutputItems)
         {
             for (int i = 0; i < item.Quantity; i++)
             {
                 Item outputItem = ItemFactory.CreateItem(item.ItemId);
                 CurrentPlayer.AddItemToInventory(outputItem);
                 _messageBroker.RaiseMessage($"\nYou created {outputItem.Name}");
             }
         }
     }
     else
     {
         _messageBroker.RaiseMessage("\nYou don't have required details for the scheme");
         _messageBroker.RaiseMessage("You need:");
         foreach (var item in scheme.RequiredItems)
         {
             _messageBroker.RaiseMessage($" You need: {item.Quantity} x {ItemFactory.GetItemNameById(item.ItemId)}");
         }
     }
 }
Ejemplo n.º 3
0
        public void CraftItemUsing(Recipe _recipe)
        {
            if (CurrentPlayer.INV.HasAllTheseItems(_recipe.INGREDIENTS))
            {
                CurrentPlayer.RemoveItemsFromInventory(_recipe.INGREDIENTS);

                foreach (ItemQuantity _itemquantity in _recipe.OUTPUTITEMS)
                {
                    for (int i = 0; i < _itemquantity.QUANTITY; i++)
                    {
                        GameItem _outputitem = ItemFactory.CreateGameItem(_itemquantity.ITEMID);
                        CurrentPlayer.AddItemToInventory(_outputitem);
                        RaiseMessage($"You craft 1 {_outputitem.NAME}");
                    }
                }
            }
            else
            {
                RaiseMessage("You do not have the required ingredients:");
                foreach (ItemQuantity _itemquantity in _recipe.INGREDIENTS)
                {
                    RaiseMessage($"     {_itemquantity.QUANTITY} {ItemFactory.ItemName(_itemquantity.ITEMID)}");
                }
            }
        }
Ejemplo n.º 4
0
        private void CompleteQuestsAtLocation()
        {
            foreach (var quest in CurrentLocation.AvailibleQuests)
            {
                QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsComplete);
                if (questToComplete != null && CurrentPlayer.Inventory.HasAllThisItems(quest.Requirements))
                {
                    CurrentPlayer.RemoveItemsFromInventory(quest.Requirements);

                    _messageBroker.RaiseMessage($"\n You completed '{quest.Name}' quest!");
                    _messageBroker.RaiseMessage($"You got {quest.RewardCredits} credits");
                    CurrentPlayer.ReciveCredits(quest.RewardCredits);

                    if (quest.RewardItems != null)
                    {
                        _messageBroker.RaiseMessage("Also you  got:");
                        foreach (var item in quest.RewardItems)
                        {
                            _messageBroker.RaiseMessage($"{item.Quantity} x {ItemFactory.GetItemNameById(item.ItemId)}");
                            CurrentPlayer.AddItemToInventory(ItemFactory.CreateItem(item.ItemId));
                        }
                    }
                    _messageBroker.RaiseMessage($"You got {quest.RewardExperience} exp");
                    CurrentPlayer.AddExp(quest.RewardExperience);

                    questToComplete.IsComplete = true;
                }
            }
        }
Ejemplo n.º 5
0
        public void CraftItemUsing(Recipe recipe)
        {
            if (CurrentPlayer.HasAllTheseItems(recipe.Ingredients))
            {
                CurrentPlayer.RemoveItemsFromInventory(recipe.Ingredients);

                foreach (ItemQuantity itemQuantity in recipe.OutputItems)
                {
                    for (int i = 0; i < itemQuantity.Quantity; i++)
                    {
                        GameItem outputItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);
                        CurrentPlayer.AddItemToInventory(outputItem);
                        RaiseMessage($"Vytvořil si 1 {outputItem.Name}");
                    }
                }
            }
            else
            {
                RaiseMessage("Nemáš dostatek materiálu:");
                foreach (ItemQuantity itemQuantity in recipe.Ingredients)
                {
                    RaiseMessage($"  {itemQuantity.Quantity} {ItemFactory.ItemName(itemQuantity.ItemID)}");
                }
            }
        }
Ejemplo n.º 6
0
        private void CompleteQuestAtLocation()
        {
            foreach (Quest quest in CurrentLocation.QuestsAvailableHere)
            {
                QuestStatus questToComplete =
                    CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID &&
                                                        !q.IsCompleted);
                if (questToComplete != null)
                {
                    if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete))
                    {
                        CurrentPlayer.RemoveItemsFromInventory(quest.ItemsToComplete);
                        RaiseMessage("");
                        RaiseMessage($"You completed the {quest.Name} quest.");
                        RaiseMessage($"You received {quest.RewardExperiencePonts} experience points.");
                        CurrentPlayer.AddExperiencePoints(quest.RewardExperiencePonts);
                        RaiseMessage($"You received {quest.RewardGold} gold.");
                        CurrentPlayer.ReceiveGold(quest.RewardGold);

                        foreach (ItemQuantity itemQuantity in quest.RewardItems)
                        {
                            GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);
                            RaiseMessage($"You received {rewardItem.Name}");
                            CurrentPlayer.AddItemToInventory(rewardItem);
                        }
                        questToComplete.IsCompleted = true;
                    }
                }
            }
        }
Ejemplo n.º 7
0
        private void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs)
        {
            MonsterLootPayoutNotification();

            CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints);
            CurrentPlayer.ReceiveGold(CurrentMonster.Gold);

            foreach(GameItem gameItem in CurrentMonster.Inventory)
            {
                CurrentPlayer.AddItemToInventory(gameItem);
            }
        }
Ejemplo n.º 8
0
        public void AttackCurrentMonster()
        {
            if (CurrentWeapon == null)
            {
                RaiseMessage("Select a weapon to attack!");
                return;
            }

            //Determine damage to monster
            int damageToMonster =
                RandomNumberGenerator.NumberBetween(CurrentWeapon.MinimumDamage, CurrentWeapon.MaximumDamage);

            if (damageToMonster == 0)
            {
                RaiseMessage("Your attack missed!");
            }
            else
            {
                CurrentMonster.CurrentHitPoints -= damageToMonster;
                RaiseMessage($"You dealt {damageToMonster} points of damage to the {CurrentMonster.Name}");
            }

            //Is the monster defeated?  Collect rewards
            if (CurrentMonster.CurrentHitPoints <= 0)
            {
                RaiseMessage($"You defeated the {CurrentMonster.Name}!");
                CurrentPlayer.Gold += CurrentMonster.Gold;
                RaiseMessage($"You received {CurrentMonster.Gold} gold.");
                CurrentPlayer.ExperiencePoints += CurrentMonster.RewardExperiencePoints;
                RaiseMessage($"You received {CurrentMonster.RewardExperiencePoints} experience points.");
                foreach (GameItem rewardItem in CurrentMonster.Inventory)
                {
                    CurrentPlayer.AddItemToInventory(rewardItem);
                    RaiseMessage($"You received a {rewardItem.Name}.");
                }
                CurrentMonster = null;
            }
            //If still alive, let the monster fight back
            else
            {
                int damageToPlayer =
                    RandomNumberGenerator.NumberBetween(CurrentMonster.MinimumDamage, CurrentMonster.MaximumDamage);
                CurrentPlayer.CurrentHitPoints -= damageToPlayer;
                RaiseMessage($"The {CurrentMonster.Name} attacks you for {damageToPlayer} damage!");
            }
            //If player is defeated return to home and heal to maximum
            if (CurrentPlayer.CurrentHitPoints <= 0)
            {
                RaiseMessage($"You were defeated by the {CurrentMonster.Name}!");
                CurrentLocation = CurrentWorld.LocationAt(0, -1);
                CurrentPlayer.CurrentHitPoints = 10 * CurrentPlayer.Level;
            }
        }
Ejemplo n.º 9
0
 private void OnCurrnetMonsterKilled(object sender, System.EventArgs eventArgs)
 {
     RaiseMessage(" ");
     RaiseMessage($"You defeated {CurrentMonster.Name}!");
     RaiseMessage($"You received {CurrentMonster.RewardExperiencePoints} experience points.");
     CurrentPlayer.AddExperiencePoints(CurrentMonster.RewardExperiencePoints);
     RaiseMessage($"You received {CurrentMonster.RewardGold} gold.");
     CurrentPlayer.ReceiveGold(CurrentMonster.Gold);
     foreach (GameItem item in CurrentMonster.Inventory)
     {
         RaiseMessage($"You received one {item.Name}.");
         CurrentPlayer.AddItemToInventory(item);
     }
 }
Ejemplo n.º 10
0
        private void CompleteQuestsAtLocation()
        {
            foreach (Quest quest in CurrentLocation.QuestsAvailableHere)
            {
                //Check player's quests and get the first one where the quest ID matches and is not completed
                QuestStatus questToComplete =
                    CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted);

                //If player has a quest in their quest list and it isn't completed
                if (questToComplete != null)
                {
                    if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete))
                    {
                        //Remove items required for quest from player's inventory
                        foreach (ItemQuantity itemQuantity in quest.ItemsToComplete)
                        {
                            for (int i = 0; i < itemQuantity.Quantity; i++)
                            {
                                //get first item from player's inventory where the itemtypeid matches
                                CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inventory.First(item => item.ItemTypeID == itemQuantity.ItemID));
                            }
                        }

                        RaiseMessage("");
                        RaiseMessage($"You completed the '{quest.Name}' quest");

                        //Give the player the quest rewards
                        RaiseMessage($"You receive {quest.RewardExperiencePoints} experience points");
                        CurrentPlayer.AddExperience(quest.RewardExperiencePoints);

                        RaiseMessage($"You receive {quest.RewardGold} gold");
                        CurrentPlayer.ReceiveGold(quest.RewardGold);


                        foreach (ItemQuantity itemQuantity in quest.RewardItems)
                        {
                            GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);

                            CurrentPlayer.AddItemToInventory(rewardItem);
                            RaiseMessage($"You receive a {rewardItem.Name}");
                        }

                        //Mark quest as completed
                        questToComplete.IsCompleted = true;
                    }
                }
            }
        }
Ejemplo n.º 11
0
        private void CompleteQuestsAtLocation()
        {
            foreach (Quest quest in CurrentLocation.QuestsAvailableHere)
            {
                RaiseMessage($"you have {quest.Name}");
                QuestStatus questToComplete =
                    CurrentPlayer.Quests.FirstOrDefault(
                        q => q.PlayerQuest.ID == quest.ID &&
                        !q.IsCompleted);

                if (questToComplete != null)
                {
                    if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete))
                    {
                        //remove the quest completion items from the player's inventory.
                        foreach (ItemQuantity itemQuantity in quest.ItemsToComplete)
                        {
                            for (int i = 0; i < itemQuantity.Quantity; i++)
                            {
                                CurrentPlayer.RemoveItemFromInventory(
                                    CurrentPlayer.Inventory.First(
                                        item => item.ItemTypeID == itemQuantity.ItemID));
                            }
                        }

                        RaiseMessage("");
                        RaiseMessage($"You completed the '{quest.Name}' quest");

                        //Give the player the quest rewards
                        CurrentPlayer.ExperiencePoints += quest.RewardExperiencePoints;
                        RaiseMessage($"You receive {quest.RewardExperiencePoints} experience points.");

                        CurrentPlayer.Gold += quest.RewardGold;
                        RaiseMessage($"You receive {quest.RewardGold} gold.");

                        foreach (ItemQuantity itemQuantity in quest.RewardItems)
                        {
                            GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);
                            CurrentPlayer.AddItemToInventory(rewardItem);
                            RaiseMessage($"You receive a {rewardItem.Name}");
                        }

                        questToComplete.IsCompleted = true;
                    }
                }
            }
        }
Ejemplo n.º 12
0
        public void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs)
        {
            RaiseMessage("");
            RaiseMessage($"Pobjedio si {CurrentMonster.Name}!");

            RaiseMessage($"Dobio si {CurrentMonster.RewardExperiencePoints} xp-a!");
            CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints);

            RaiseMessage($"Dobio si {CurrentMonster.Gold} golda!");
            CurrentPlayer.RecieveGold(CurrentMonster.Gold);

            foreach (GameItem gameItem in CurrentMonster.Inventory)
            {
                RaiseMessage($"Dobio si jedan {gameItem.Name}.");
                CurrentPlayer.AddItemToInventory(gameItem);
            }
        }
Ejemplo n.º 13
0
        private void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs)
        {
            RaiseMessage("");
            RaiseMessage($"You killed {CurrentMonster.Name}.");

            RaiseMessage($"You received {CurrentMonster.Gold} gold");
            CurrentPlayer.ReceiveGold(CurrentMonster.Gold);

            RaiseMessage($"You received {CurrentMonster.RewardEXPPoint} points of EXP.");
            CurrentPlayer.AddEXPPoint(CurrentMonster.RewardEXPPoint);

            foreach (GameItem gameItem in CurrentMonster.Inventory)
            {
                RaiseMessage($"You received one {gameItem.Name}");
                CurrentPlayer.AddItemToInventory(gameItem);
            }
        }
Ejemplo n.º 14
0
        private void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs)
        {
            RaiseMessage("");
            RaiseMessage($"Zabil si {CurrentMonster.Name}!");

            RaiseMessage($"Dostal si {CurrentMonster.RewardExperiencePoints} XP.");
            CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints);

            RaiseMessage($"Dostal si {CurrentMonster.Gold} zlatých.");
            CurrentPlayer.ReceiveGold(CurrentMonster.Gold);

            foreach (GameItem gameItem in CurrentMonster.Inventory)
            {
                RaiseMessage($"Dostal si {gameItem.Name}.");
                CurrentPlayer.AddItemToInventory(gameItem);
            }
        }
Ejemplo n.º 15
0
        public void CraftItemUsing(Recipe recipe)
        {
            if (CurrentPlayer.HasAllTheseItems(recipe.Ingredients))
            {
                CurrentPlayer.RemoveItemsFromInventory(recipe.Ingredients);

                foreach (ItemQuantity itemQuantity in recipe.OutputItems)
                {
                    for (int i = 0; i < itemQuantity.Quantity; i++)
                    {
                        GameItem outputItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);
                        CurrentPlayer.AddItemToInventory(outputItem);
                        RaiseMessage($"You craft 1 {outputItem.Name}");
                    }
                }
            }
        }
Ejemplo n.º 16
0
 public void KillReward()
 {
     if (CurrentEnemy.Health <= 0)
     {
         messageLog.Add($"You defeat {CurrentEnemy.Name.ToLower()}");
         messageLog.Add("You gain " + CurrentEnemy.RewardExp + " experienece");
         messageLog.Add("You gain " + CurrentEnemy.Gold + " gold");
         messageLog.Add("Press [x] to exit...");
         foreach (Item item in CurrentEnemy.Inventory)
         {
             CurrentPlayer.AddItemToInventory(item);
             messageLog.Add("You obtain " + item.Name);
         }
         CurrentPlayer.Experience += CurrentEnemy.RewardExp;
         CurrentPlayer.AddGold(CurrentEnemy.Gold);
     }
 }
Ejemplo n.º 17
0
        private void CompleteQuestsAtLocation()
        {
            foreach (Quest quest in CurrentLocation.QuestsAvailableHere)
            {
                QuestStatus questToComplete =
                    CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID &&
                                                        !q.IsCompleted);

                if (questToComplete != null)
                {
                    if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete))
                    {
                        CurrentPlayer.RemoveItemsFromInventory(quest.ItemsToComplete);

                        RaiseMessage("");
                        RaiseMessage($"Dokončil si '{quest.Name}' úkol");

                        // Give the player the quest rewards
                        RaiseMessage($"Dostal si {quest.RewardExperiencePoints} XP");
                        CurrentPlayer.AddExperience(quest.RewardExperiencePoints);

                        RaiseMessage($"Dostal si {quest.RewardGold} zlatých");
                        CurrentPlayer.ReceiveGold(quest.RewardGold);

                        foreach (ItemQuantity itemQuantity in quest.RewardItems)
                        {
                            GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);

                            RaiseMessage($"Dostal si {rewardItem.Name}");
                            CurrentPlayer.AddItemToInventory(rewardItem);
                        }

                        // Mark the Quest as completed
                        questToComplete.IsCompleted = true;

                        AttunementFactory.attunements.ForEach(delegate(Attunement att)
                        {
                            if (att.AttunementQuest == quest)
                            {
                                att.CompleteAttunement(att);
                            }
                        });
                    }
                }
            }
        }
Ejemplo n.º 18
0
        private void OnCurrentMonsterKilled(object sender, System.EventArgs e)
        {
            RaiseMessage("");
            RaiseMessage($"You defeated the {CurrentMonster.NAME}!");

            RaiseMessage($"You receive {CurrentMonster.REWARDEXP} experience points");
            CurrentPlayer.AddExperience(CurrentMonster.GOLD);

            RaiseMessage($"You receive {CurrentMonster.GOLD} gold.");
            CurrentPlayer.ReceiveGold(CurrentMonster.GOLD);

            foreach (GameItem gameitem in CurrentMonster.INV.ITEMS)
            {
                CurrentPlayer.AddItemToInventory(gameitem);
                RaiseMessage($"You receive one {gameitem.NAME}");
            }
        }
Ejemplo n.º 19
0
        private void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs)
        {
            RaiseMessage("");
            RaiseMessage(Emote.HAPPY, $"You defeated the {CurrentMonster.Name}!");

            RaiseMessage(Emote.REWARD, $"You receive {CurrentMonster.RewardExperiencePoints} experience points.");
            CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints);

            RaiseMessage(Emote.REWARD, $"You receive {CurrentMonster.Gold} gold.");
            CurrentPlayer.ReceiveGold(CurrentMonster.Gold);

            foreach (GameItem gameItem in CurrentMonster.Inventory)
            {
                RaiseMessage(Emote.REWARD, $"You receive one {gameItem.Name}.");
                CurrentPlayer.AddItemToInventory(gameItem);
            }
        }
Ejemplo n.º 20
0
        // When you kill a monster display message
        private void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs)
        {
            RaiseMessage("");
            RaiseMessage($"You defeated {CurrentMonster.Name}!");

            RaiseMessage($"You receive {CurrentMonster.RewardExperiencePoints} experience points.");
            CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints);

            RaiseMessage($"You recieve {CurrentMonster.Money} money.");
            CurrentPlayer.RecieveMoney(CurrentMonster.Money);

            foreach (GameItem gameItem in CurrentMonster.Inventory)
            {
                RaiseMessage($"You recieve one {gameItem.Name}.");
                CurrentPlayer.AddItemToInventory(gameItem);
            }
        }
Ejemplo n.º 21
0
        private void CompleteQuestsAtLocation()
        {
            foreach (Quest quest in CurrentLocation.QuestsAvailableHere)
            {
                QuestStatus questToComplete =
                    CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID &&
                                                        !q.IsCompleted);

                if (questToComplete != null)
                {
                    if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete))
                    {
                        // Removaj quest completion iteme igracu
                        foreach (ItemQuantity itemQuantity in quest.ItemsToComplete)
                        {
                            for (int i = 0; i < itemQuantity.Quantity; i++)
                            {
                                CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inventory.First(item => item.ItemTypeID == itemQuantity.ItemID));
                            }
                        }

                        RaiseMessage("");
                        RaiseMessage($"Zavrsio si '{quest.Name}' quest");

                        // Daj playeru reward
                        RaiseMessage($"Dobio si {quest.RewardExperiencePoints} xp-a");
                        CurrentPlayer.AddExperience(quest.RewardExperiencePoints);

                        RaiseMessage($"Dobio si {quest.RewardGold} golda");
                        CurrentPlayer.RecieveGold(quest.RewardGold);

                        foreach (ItemQuantity itemQuantity in quest.RewardItems)
                        {
                            GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);

                            RaiseMessage($"Dobio si {rewardItem.Name}");
                            CurrentPlayer.AddItemToInventory(rewardItem);
                        }

                        // Markuj quest kao compelted
                        questToComplete.IsCompleted = true;
                    }
                }
            }
        }
Ejemplo n.º 22
0
        private void CompleteQuestsAtLocation()
        {
            foreach (Quest quest in CurrentLocation.QuestsAvailableHere)                                // for each quest available in curent location...
            {
                QuestStatus questToComplete =
                    CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted);   // Check players quests and get first one with matches ID and is not completed
                                                                                                                // If player has already completed quest, this will return Default (as no new quest for Player to complete)

                if (questToComplete != null)
                {
                    if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete))
                    {
                        // Remove the quest completion items from the player's inventory
                        foreach (ItemQuantity itemQuantity in quest.ItemsToComplete)
                        {
                            for (int i = 0; i < itemQuantity.Quantity; i++)
                            {
                                CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inventory.First(item => item.ItemTypeID == itemQuantity.ItemID));
                            }
                        }

                        RaiseMessage("");
                        RaiseMessage($"You completed the '{quest.Name}' quest");

                        //Give the player the quest rewards
                        RaiseMessage($"You receive {quest.RewardExperiencePoints} experience points");
                        CurrentPlayer.AddExperience(quest.RewardExperiencePoints);

                        RaiseMessage($"You receive {quest.RewardGold} gold");
                        CurrentPlayer.ReceiveGold(quest.RewardGold);

                        foreach (ItemQuantity itemQuantity in quest.RewardItems)
                        {
                            GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);

                            RaiseMessage($"You receive a {rewardItem.Name}");
                            CurrentPlayer.AddItemToInventory(rewardItem);
                        }

                        //Marking Quest as completed
                        questToComplete.IsCompleted = true;
                    }
                }
            }
        }
Ejemplo n.º 23
0
        private void CompleteQuestsAtLocation()
        {
            foreach (Quest quest in CurrentLocation.QuestsAvailableHere)
            {
                QuestStatus questToComplete =
                    CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID &&
                                                        !q.IsCompleted);

                if (questToComplete != null)
                {
                    if (CurrentPlayer.HasAllTheseItems(quest.PotrzebnaIlość))
                    {
                        // Zabierz itemy do questa z plecaka gracza
                        foreach (ItemQuantity itemQuantity in quest.PotrzebnaIlość)
                        {
                            for (int i = 0; i < itemQuantity.Ilość; i++)
                            {
                                CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inwentarz.First(item => item.IdItemka == itemQuantity.IdPrzedmiotu));
                            }
                        }

                        RaiseMessage("");
                        RaiseMessage($"'{quest.Nazwa}' - to zadanie zostało ukończone");

                        // Przydziel nagrodę
                        CurrentPlayer.PunktyDoswiadczenia += quest.DoświadczenieDoZdobycia;
                        RaiseMessage($" {quest.DoświadczenieDoZdobycia} - otrzymane punkty doświadczenia");

                        CurrentPlayer.Złoto += quest.ZłotoDoZdobycia;
                        RaiseMessage($"{quest.ZłotoDoZdobycia} otrzymane złoto");

                        foreach (ItemQuantity itemQuantity in quest.Nagroda)
                        {
                            GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.IdPrzedmiotu);

                            CurrentPlayer.AddItemToInventory(rewardItem);
                            RaiseMessage($"{rewardItem.Nazwa} - zdobyto nowy przedmiot");
                        }

                        // Oznacz zadanie jako ukonczone
                        questToComplete.IsCompleted = true;
                    }
                }
            }
        }
Ejemplo n.º 24
0
        public void CompleteQuestsAtLocation()
        {
            foreach (Quest quest in CurrentLocation.QuestsAvailableHere)
            {
                QuestStatus questToComplete =
                    CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted);

                if (questToComplete != null)
                {
                    if (CurrentPlayer.HasAllQuestItems(quest.ItemsToComplete))
                    {
                        // Remove quest items from inventory
                        foreach (ItemQuantity itemQuantity in quest.ItemsToComplete)
                        {
                            for (int i = 0; i < itemQuantity.Quantity; i++)
                            {
                                CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inventory.First(item => item.ItemTypeID == itemQuantity.ItemID));
                            }
                        }

                        RaiseMessage("");
                        RaiseMessage($"You completed the {quest.Name} quest!");

                        // Give the quest rewards
                        CurrentPlayer.Experience += quest.RewardExperience;
                        RaiseMessage($"You receive {quest.RewardExperience} XP!");

                        CurrentPlayer.Gold += quest.RewardGold;
                        RaiseMessage($"You receive {quest.RewardGold} gold!");

                        foreach (ItemQuantity itemQuantity in quest.RewardItems)
                        {
                            GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);

                            CurrentPlayer.AddItemToInventory(rewardItem);
                            RaiseMessage($"You receive a {rewardItem.Name}!");
                        }

                        // Mark quest as complete
                        questToComplete.IsCompleted = true;
                    }
                }
            }
        }
Ejemplo n.º 25
0
        // Quest Handling Functions
        private void CompleteQuestsAtLocation()
        {
            foreach (Quest quest in CurrentLocation.QuestsAvailableHere)
            {
                QuestStatus questToComplete =
                    CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID &&
                                                        !q.IsCompleted);

                if (questToComplete != null)
                {
                    if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete))
                    {
                        // Remove the quest completion items from the player's inventory
                        foreach (ItemQuantity itemQuantity in quest.ItemsToComplete)
                        {
                            for (int i = 0; i < itemQuantity.Quantity; i++)
                            {
                                CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inventory.First(item => item.ItemTypeID == itemQuantity.ItemID));
                            }
                        }

                        //Notify Player of Quest Completion
                        QuestCompletionNotification(quest.Name, quest.RewardExperiencePoints, quest.RewardGold);

                        // Give the player the quest rewards

                        CurrentPlayer.AddExperience(quest.RewardExperiencePoints);
                        CurrentPlayer.ReceiveGold(quest.RewardGold);

                        foreach (ItemQuantity itemQuantity in quest.RewardItems)
                        {
                            GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);
                            QuestCompletionRewardItemNotification(rewardItem.Name);
                            CurrentPlayer.AddItemToInventory(rewardItem);
                        }



                        // Mark the Quest as completed
                        questToComplete.IsCompleted = true;
                    }
                }
            }
        }
Ejemplo n.º 26
0
        private void CompleteQuestAtLocation()
        {
            foreach (Quest quest in CurrentLocation.QuestsAvailableHere)
            {
                QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.ID == quest.ID && !q.IsCompleted);

                if (questToComplete != null)
                {
                    if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete))
                    {
                        //Remove the quest items from inventory
                        foreach (ItemQuantity itemQuantity in quest.ItemsToComplete)
                        {
                            for (int i = 0; i < itemQuantity.Quantity; i++)
                            {
                                CurrentPlayer.RemoveItemFromInventory(CurrentPlayer.Inventory.First(item => item.ItemTypeID == itemQuantity.ItemID));
                            }
                        }

                        RaiseMessage("");
                        RaiseMessage($"You completed the '{quest.Name}' quest. Hooray for you!");

                        //Give player rewards
                        CurrentPlayer.AddExperience(quest.RewardExperiencePoints);
                        RaiseMessage($"You recieve {quest.RewardExperiencePoints} XP.");

                        CurrentPlayer.RecieveGold(quest.RewardGold);
                        RaiseMessage($"You recieve {quest.RewardGold} Gold.");

                        foreach (ItemQuantity itemQuantity in quest.RewardItems)
                        {
                            GameItem rewardItem = ItemFactory.CreateGameItem(itemQuantity.ItemID);

                            CurrentPlayer.AddItemToInventory(rewardItem);
                            RaiseMessage($"You recieve a {rewardItem.Name}.");
                        }

                        //Mark quest as complete
                        questToComplete.IsCompleted = true;
                    }
                }
            }
        }
Ejemplo n.º 27
0
        private void OnCurrentMonsterKilled(object sender, System.EventArgs eventArgs)
        {
            RaiseMessage("");
            RaiseMessage($"Well done you slaughter an innocent {CurrentMonster.Name}. How could you...");

            RaiseMessage($"I suppose you want a reward, you heartless murderer. Have {CurrentMonster.RewardExperiencePoints} XP");
            CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints);


            RaiseMessage($"And {CurrentMonster.Gold} gold.");
            CurrentPlayer.RecieveGold(CurrentMonster.Gold);


            foreach (GameItem gameItem in CurrentMonster.Inventory)
            {
                RaiseMessage($"You recieved one {gameItem.Name}.");
                CurrentPlayer.AddItemToInventory(gameItem);
            }
        }
Ejemplo n.º 28
0
        public void BuySelectedItem()
        {
            if (itemChoice <= CurrentTrader.Inventory.Count)
            {
                var toBuy = CurrentTrader.Inventory[itemChoice];

                if (CurrentPlayer.Gold < toBuy.Price)
                {
                    messageLog.Add($"You don't have enough gold to buy {toBuy.Name}!");
                }
                else
                {
                    CurrentPlayer.AddItemToInventory(toBuy);
                    CurrentLocation.TraderHere.RemoveItemFromInventory(toBuy);
                }
            }
            else
            {
                gui.CloseItemSelected();
            }
        }
Ejemplo n.º 29
0
        private void CompleteQuestsAtLocation()
        {
            foreach (Quest quest in CurrentLocation.QuestsAvailableHere)
            {
                QuestStatus questToComplete = CurrentPlayer.Quests.FirstOrDefault(q =>
                                                                                  q.PlayerQuest.ID == quest.ID && !q.IsCompleted);

                if (questToComplete != null)
                {
                    if (CurrentPlayer.HasAllTheseItems(quest.QuestItems))
                    {
                        //remove items from player's inventory
                        foreach (ItemQuantity iq in quest.QuestItems)
                        {
                            for (int i = 0; i < iq.Quantity; i++)
                            {
                                CurrentPlayer.RemoveItemFromInventory(
                                    CurrentPlayer.Inventory.First(
                                        item => item.ItemTypeID == iq.ItemId));
                            }
                        }
                        RaiseMessage("");
                        RaiseMessage($"Yuo completed the {quest.Name} quest.");

                        //give player the rewards
                        CurrentPlayer.ExperiencePoints += quest.RewardXP;
                        CurrentPlayer.Gold             += quest.RewardGold;
                        RaiseMessage($"You received {quest.RewardXP} EXP \n and {quest.RewardGold} gold.");

                        foreach (ItemQuantity iq in quest.RewardItems)
                        {
                            GameItem reward = ItemFactory.CreateGameItem(iq.ItemId);
                            CurrentPlayer.AddItemToInventory(reward);
                            RaiseMessage($"You received {reward.Name}.");
                        }
                        questToComplete.IsCompleted = true;
                    }
                }
            }
        }
Ejemplo n.º 30
0
 public void CompleteQuestAtLocation()
 {
     //Does the player have a matching quest?
     foreach (Quest quest in CurrentLocation.QuestsAvailableHere)
     {
         QuestStatus questStatusToComplete =
             CurrentPlayer.Quests.FirstOrDefault(q => q.PlayerQuest.QuestId == quest.QuestId);
         {
             //Is that quest complete?
             if (questStatusToComplete != null && !questStatusToComplete.IsCompleted)
             {
                 //Does the player have the necessary items?
                 if (CurrentPlayer.HasAllTheseItems(quest.ItemsToComplete))
                 {
                     //If so give player rewards
                     RaiseMessage("");
                     RaiseMessage($"Quest {quest.Name} complete!");
                     RaiseMessage("You recieve..");
                     foreach (GameItem rewardItem in quest.RewardItems)
                     {
                         CurrentPlayer.AddItemToInventory(rewardItem);
                         RaiseMessage(rewardItem.Name);
                     }
                     CurrentPlayer.Gold += quest.RewardGold;
                     RaiseMessage($"{quest.RewardGold} Gold");
                     CurrentPlayer.ExperiencePoints += quest.RewardExperiencePoints;
                     RaiseMessage($"{quest.RewardExperiencePoints} Experience");
                     //remove items from inventory
                     foreach (ItemQuantity questItemQuantity in quest.ItemsToComplete)
                     {
                         CurrentPlayer.RemoveItemQuantity(questItemQuantity);
                     }
                     //and mark quest complete
                     questStatusToComplete.IsCompleted = true;
                 }
             }
         }
     }
 }