Exemplo n.º 1
0
        /// <summary>
        ///     Refreshes all open missions.
        /// </summary>
        public void RefreshOpenMissions()
        {
            if (this._level.GetState() != 4)
            {
                LogicClientAvatar playerAvatar = this._level.GetPlayerAvatar();
                LogicDataTable    missionTable = LogicDataTables.GetTable(20);

                for (int i = 0; i < missionTable.GetItemCount(); i++)
                {
                    LogicMissionData missionData = (LogicMissionData)missionTable.GetItemAt(i);

                    if (missionData.IsOpenForAvatar(playerAvatar))
                    {
                        int index = -1;

                        for (int j = 0; j < this._openMissions.Count; j++)
                        {
                            if (this._openMissions[j].GetMissionData() == missionData)
                            {
                                index = j;
                                break;
                            }
                        }

                        if (index == -1)
                        {
                            LogicMission mission = new LogicMission(missionData, this._level);
                            mission.RefreshProgress();
                            this._openMissions.Add(mission);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Ticks this instance.
        /// </summary>
        public void Tick()
        {
            bool refresh = false;

            for (int i = 0; i < this._openMissions.Count; i++)
            {
                LogicMission mission = this._openMissions[i];

                if (mission != null)
                {
                    mission.RefreshProgress();

                    if (mission.IsFinished())
                    {
                        mission.Destruct();
                        this._openMissions.Remove(i--);
                        refresh = true;
                    }
                    else
                    {
                        mission.Tick();
                    }
                }
            }

            if (refresh)
            {
                this.RefreshOpenMissions();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Gets the mission by category.
        /// </summary>
        public LogicMission GetMissionByCategory(int category)
        {
            for (int i = 0; i < this._openMissions.Count; i++)
            {
                LogicMission mission = this._openMissions[i];

                if (mission.GetMissionData().GetMissionCategory() == category)
                {
                    return(mission);
                }
            }

            return(null);
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Gets the mission by data.
        /// </summary>
        public LogicMission GetMissionByData(LogicMissionData data)
        {
            for (int i = 0; i < this._openMissions.Count; i++)
            {
                LogicMission mission = this._openMissions[i];

                if (mission.GetMissionData() == data)
                {
                    return(mission);
                }
            }

            return(null);
        }