Beispiel #1
0
        public void NextStage()
        {
            ushort tokunlocked = (ushort)Stage.Objectives.First().Objective.TokCompleted;

            foreach (uint Plr in ActivePlayers)
            {
                Player targPlayer = Player.GetPlayer(Plr);
                if (targPlayer != null)
                {
                    if (tokunlocked > 0)
                    {
                        targPlayer.TokInterface.AddTok(tokunlocked);
                    }
                }
            }

            Stage.Cleanup();
            int nextStageId = Stage.Number + 1;

            EvtInterface.RemoveEvent(Failed);

            foreach (PQuestStage sStage in Stages)
            {
                if (sStage.Number == nextStageId)
                {
                    Stage = sStage;
                    Stage.Reset();
                    _stageTimeEnd = TCPManager.GetTimeStamp() + ((Stage.Time > 0 ? Stage.Time : TIME_EACH_STAGE));
                    if (sStage.Objectives.First().Objective.Type != (byte)Objective_Type.QUEST_PROTECT_UNIT)
                    {
                        EvtInterface.AddEvent(Failed, (Stage.Time > 0 ? Stage.Time : TIME_EACH_STAGE) * 1000, 1);
                    }

                    foreach (uint Plr in ActivePlayers)
                    {
                        Player targPlayer = Player.GetPlayer(Plr);
                        if (targPlayer != null)
                        {
                            SendCurrentStage(targPlayer);
                            if (Stage.Number > 1)
                            {
                                targPlayer.AddInfluence((ushort)Info.ChapterId, 250);
                            }
                        }
                    }
                    return;
                }
            }

            End();
        }
Beispiel #2
0
        public void Start()
        {
            if (_started || _ended)
            {
                return;
            }

            foreach (PQuestStage sStage in Stages)
            {
                try
                {
                    if (sStage.Number == 0)
                    {
                        Stage = sStage;
                        Stage.Reset();
                        foreach (uint Plr in ActivePlayers)
                        {
                            Player targPlayer = Player.GetPlayer(Plr);
                            if (targPlayer != null)
                            {
                                SendCurrentStage(targPlayer);
                            }
                        }
                        break;
                    }
                }
                catch
                {
                    continue;
                }
            }

            #if DEBUG
            Log.Success("PQuest", "Starting Quest " + Info.Name);
            #endif

            _started = true;
        }