Beispiel #1
0
 public TimedEvent(string method, int time, PyScript script)
 {
     this.Method                = method;
     this.Time                  = time;
     this.Script                = script;
     this.DelayerTimer          = new Timer(time);
     this.DelayerTimer.Enabled  = true;
     this.DelayerTimer.Elapsed += new ElapsedEventHandler(DelayerTimer_Elapsed);
     this.DelayerTimer.Start();
 }
Beispiel #2
0
        public static void Load()
        {
            PyScriptPlatform.LoadWorldMemory();
            Scripts.Clear();
            foreach (var f in Directory.GetFiles("Scripts"))
            {
                var fInfos = new FileInfo(f);
                if (fInfos.Extension.ToLower() == ".py")
                {
                    try
                    {
                        var script = new PyScript(f);
                        script.Load();
                        Scripts.Add(script);
                    }
                    catch (Exception e)
                    {
                        Utilities.ConsoleStyle.Error("Can't load script engine for '" + f + "' : " + e.ToString());
                    }
                }
            }

            foreach (var f in Directory.GetFiles("Scripts/System"))
            {
                var fInfos = new FileInfo(f);
                if (fInfos.Extension.ToLower() == ".py")
                {
                    try
                    {
                        var script = new PyScript(f);
                        script.Load();
                        Scripts.Add(script);
                    }
                    catch (Exception e)
                    {
                        Utilities.ConsoleStyle.Error("Can't load script engine for '" + f + "' : " + e.ToString());
                    }
                }
            }
        }
Beispiel #3
0
        public static void Load()
        {
            PyScriptPlatform.LoadWorldMemory();
            Scripts.Clear();
            foreach (var f in Directory.GetFiles("Scripts"))
            {
                var fInfos = new FileInfo(f);
                if (fInfos.Extension.ToLower() == ".py")
                {
                    try
                    {
                        var script = new PyScript(f);
                        script.Load();
                        Scripts.Add(script);
                    }
                    catch (Exception e)
                    {
                        Utilities.ConsoleStyle.Error("Can't load script engine for '" + f + "' : " + e.ToString());
                    }
                }
            }

            foreach (var f in Directory.GetFiles("Scripts/System"))
            {
                var fInfos = new FileInfo(f);
                if (fInfos.Extension.ToLower() == ".py")
                {
                    try
                    {
                        var script = new PyScript(f);
                        script.Load();
                        Scripts.Add(script);
                    }
                    catch (Exception e)
                    {
                        Utilities.ConsoleStyle.Error("Can't load script engine for '" + f + "' : " + e.ToString());
                    }
                }
            }
        }
Beispiel #4
0
        public Fighter(int id, Database.Records.MonsterLevelRecord monster, Engines.Map.MonsterGroup group)
        {
            this.Drops = new FightDrops(this);
            this.MonsterGroup = group;
            this.Monster = monster;

            this._id = id;
            this._currentLife = this.Monster.Life;

            this.IsHuman = false;
            this.IsReady = true;
            this.IsDead = false;

            switch (Monster.GetTemplate.AI)
            {
                case 0:
                    this.ArtificialBrain = new AI.StaticAI(this);
                    break;

                case 1:
                case 2:
                    this.ArtificialBrain = new AI.BasicAI(this);
                    break;

                case 3:
                    this.ArtificialBrain = new AI.FearfulAI(this);
                    break;

                case 4:
                    this.ArtificialBrain = new AI.ScriptedAI(this);
                    if (this.Monster.GetTemplate.HasScriptAI())
                    {
                        var scriptID = this.Monster.GetTemplate.Script;
                        var script = new PyScript("Scripts/AI/" + scriptID);
                        script.Load(this);

                        (this.ArtificialBrain as AI.ScriptedAI).Script = script;
                    }
                    break;
            }

            this.CurrentAP = Stats.GetMaxActionPoints;
            this.CurrentMP = Stats.GetMaxMovementPoints;
        }
Beispiel #5
0
 public PyScriptPlatform(PyScript script)
 {
     this.Script = script;
 }
 public PyScriptPlatform(PyScript script)
 {
     this.Script = script;
 }
Beispiel #7
0
 public TimedEvent(string method, int time, PyScript script)
 {
     this.Method = method;
     this.Time = time;
     this.Script = script;
     this.DelayerTimer = new Timer(time);
     this.DelayerTimer.Enabled = true;
     this.DelayerTimer.Elapsed += new ElapsedEventHandler(DelayerTimer_Elapsed);
     this.DelayerTimer.Start();
 }