Exemplo n.º 1
0
    public void SetQuestLogActive(int questid)
    {
        bool check = false;

        if (QuestLogScript == null)
        {
            QuestLogScript = GameObject.FindGameObjectWithTag("HUD").GetComponent <HandleQuestlog>();
        }
        foreach (QuestObject activequest in ActiveQuests)
        {
            if (activequest.m_QuestID == questid)
            {
                QuestLogScript.AddQuestToList(
                    activequest.m_QuestID,
                    activequest.m_QuestTitle,
                    activequest.m_QuestGivenDialogue,
                    activequest.m_RequiredItemID,
                    activequest.m_RequiredEnemyID,
                    activequest.m_RequiresKillAmount,
                    activequest.m_CurrentItemID,
                    activequest.m_CurrentKillAmount);
                check = true;
            }
        }
        if (check)
        {
        }
        else
        {
            Debug.Log("[QUESTLOG] ERROR: Couldn't add to Questlog, check quest");
        }
    }
Exemplo n.º 2
0
 public void UpdateQuestLog(int questid)
 {
     if (QuestLogScript == null)
     {
         QuestLogScript = GameObject.FindGameObjectWithTag("HUD").GetComponent <HandleQuestlog>();
     }
     foreach (QuestObject activequest in ActiveQuests)
     {
         if (activequest.m_QuestID == questid)
         {
             QuestLogScript.UpdateLog(activequest.m_QuestID, activequest.m_CurrentItemID, activequest.m_CurrentKillAmount);
         }
     }
 }
Exemplo n.º 3
0
    public bool CheckUnlock(int questid)
    {
        if (inventoryscript == null)
        {
            inventoryscript = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory>();
        }
        if (QuestLogScript == null)
        {
            QuestLogScript = GameObject.FindGameObjectWithTag("HUD").GetComponent <HandleQuestlog>();
        }
        bool   unlocked = false;
        string title    = "";

        int[] requnlockcheckid;
        foreach (QuestObject unlockquest in DatabaseQuests)
        {
            if (unlockquest.m_RequiresQuestUnlock)
            {
                int QUC = unlockquest.m_RequiredQuestID.Length;
                requnlockcheckid = new int[QUC];
                for (int i = 0; i < QUC; i++)
                {
                    if (unlockquest.m_RequiredQuestID[i] == questid)
                    {
                        title = unlockquest.m_QuestTitle;
                        QuestLogScript.DisplayQuestUnlock(title);
                        unlocked = true;
                    }
                }
            }
        }
        if (unlocked)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 4
0
    public bool RegisterItemID(int itemid)
    {
        if (inventoryscript == null)
        {
            inventoryscript = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory>();
        }
        if (QuestLogScript == null)
        {
            QuestLogScript = GameObject.FindGameObjectWithTag("HUD").GetComponent <HandleQuestlog>();
        }
        bool Registereditemid = false;

        foreach (QuestObject activequest in ActiveQuests)
        {
            if (activequest.m_RequiresItem)
            {
                int[] itemsid  = activequest.m_RequiredItemID;
                int   countids = itemsid.Length;
                for (int i = 0; i < countids; i++)
                {
                    if (itemsid[i] == itemid)
                    {
                        activequest.m_CurrentItemID[i] = itemid;
                        Registereditemid = true;
                        UpdateQuestLog(activequest.m_QuestID);
                        Debug.Log("[QUEST] Registered itemid: " + itemid + " at listposition: " + i + " for Quest: " + activequest.m_QuestTitle);
                    }
                }

                bool allitemscheck = true;
                if (activequest.m_CurrentItemID.Length > 1)
                {
                    for (int i = 0; i < countids; i++)
                    {
                        if (activequest.m_CurrentItemID[i] != activequest.m_RequiredItemID[i])
                        {
                            allitemscheck = false;
                            break;
                        }
                    }
                }
                else
                {
                    if (activequest.m_CurrentItemID[0] != activequest.m_RequiredItemID[0])
                    {
                        allitemscheck = false;
                    }
                }

                if (allitemscheck)
                {
                    activequest.m_QuestRequirementsMet = true;
                    Debug.Log("[QUEST] " + activequest.m_QuestTitle + " has it's all requirements met!");
                }
            }
        }
        if (Registereditemid)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }