Exemple #1
0
    public void CompleteQuest(NPCQuest quest)
    {
        if (player.Inventory.Count + quest.QuestReward.Count <= player.MaxInventorySpace)
        {
            for (int i = 0; i < quest.QuestReward.Count; i += 0)
            {
                bool addedItem = player.AddItem(quest.QuestReward[i]);
                if (addedItem)
                {
                    quest.QuestReward.RemoveAt(i);
                }
                else
                {
                    Debug.Log("Stack is full");
                }
            }

            if (quest.QuestReward.Count == 0)
            {
                player.AddExp(quest.QuestExpReward);
                player.ModifyGold(quest.QuestGoldReward);
                quest.isFinished = true;
                player.questsComplete.Add(quest);

                if (quest.qego != null && !quest.EnableQuestGOPerm)
                {
                    quest.qego.DisableGameObjects();
                }
                if (quest.numberToObtain > 0)
                {
                    for (int i = 0; i < player.Inventory.Count; i++)
                    {
                        if (player.Inventory[i].Name == quest.nameOfItem)
                        {
                            player.Inventory[i].CurStacks -= quest.numberToObtain;
                            if (player.Inventory[i].CurStacks <= 0)
                            {
                                player.Inventory.RemoveAt(i);
                            }
                        }
                    }
                }

                player.QuestsInProgress.Remove(quest);
                EnterDialog();
            }
        }
        else
        {
            Debug.Log("Inventory is Full!");
        }
    }
Exemple #2
0
    public bool PlayerBuyItem(int arrayNum)
    {
        Item itemToBuy = vendorItems[arrayNum];

        if (player.Gold >= itemToBuy.Value)         //If we have enough gold to buy
        {
            if (player.AddItem(itemToBuy))
            {
                player.ModifyGold(-1 * itemToBuy.Value);
                vendorItems.RemoveAt(arrayNum);
                return(true);
            }
        }

        return(false);
    }
Exemple #3
0
 public void AddGold()
 {
     player.ModifyGold(GoldToAdd);
 }