public void LoadScriptInterpreter(GameClient client)
        {
            var parser   = new YamlMenuParser();
            var yamlPath = ServerContextBase.StoragePath + $@"\Scripts\Menus\{Mundane.Template.Name}.yaml";

            if (File.Exists(yamlPath))
            {
                if (client.MenuInterpter == null)
                {
                    client.MenuInterpter = parser.CreateInterpreterFromFile(yamlPath);

                    client.MenuInterpter.Client = client;

                    client.MenuInterpter.OnMovedToNextStep += MenuInterpreter_OnMovedToNextStep;

                    client.MenuInterpter.RegisterCheckpointHandler("QuestCompleted", (_client, res) =>
                    {
                        if (_client.Aisling.HasQuest(res.Value))
                        {
                            res.Result = _client.Aisling.HasCompletedQuest(res.Value);
                        }
                    });

                    client.MenuInterpter.RegisterCheckpointHandler("HasAForm",
                                                                   (_client, res) => { res.Result = _client.Aisling.AnimalForm != AnimalForm.None; });

                    client.MenuInterpter.RegisterCheckpointHandler("LearnForm1",
                                                                   (_client, res) => { _client.Aisling.AnimalForm = AnimalForm.Draco; });

                    client.MenuInterpter.RegisterCheckpointHandler("LearnForm2",
                                                                   (_client, res) => { _client.Aisling.AnimalForm = AnimalForm.Kelberoth; });

                    client.MenuInterpter.RegisterCheckpointHandler("LearnForm3",
                                                                   (_client, res) => { _client.Aisling.AnimalForm = AnimalForm.WhiteBat; });

                    client.MenuInterpter.RegisterCheckpointHandler("LearnForm4",
                                                                   (_client, res) => { _client.Aisling.AnimalForm = AnimalForm.Scorpion; });

                    client.MenuInterpter.RegisterCheckpointHandler("HasKilled", (_client, res) =>
                    {
                        if (_client.Aisling.HasQuest(quest.Name))
                        {
                            if (_client.Aisling.HasKilled(res.Value, res.Amount))
                            {
                                if (!_client.Aisling.HasCompletedQuest(quest.Name))
                                {
                                    _client.Aisling.CompleteQuest(quest.Name);
                                    quest.OnCompleted(_client.Aisling);
                                }

                                res.Result = true;
                            }
                        }
                    });

                    ServerContextBase.Debug("Script Interpreter Created for Mundane: {0}", Mundane.Template.Name);
                }
            }
        }
Esempio n. 2
0
        public override void Update(TimeSpan elapsedTime)
        {
            _timer.Update(elapsedTime);



            if (_timer.Elapsed)
            {
                _timer.Reset();
                ServerContextBase.Debug($"Server Running on {Process.GetCurrentProcess().Threads.Count} Threads.");
            }
        }
Esempio n. 3
0
 public virtual void ClientConnected(TClient client)
 {
     ServerContextBase.Debug("Connection From {0} Established.",
                             client.ServerSocket.RemoteEndPoint.ToString());
 }