コード例 #1
0
        private void Destruct_Button_Click(object sender, RoutedEventArgs e)
        {
            var ob = (BaseObject)this.DataContext;

            var args = new Dictionary <string, object>()
            {
                { "obid", ob.ObjectID },
            };

            var script = "world.GetObject(obid).Destruct()";

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #2
0
        private void Destruct_Button_Click(object sender, RoutedEventArgs e)
        {
            var ob = (BaseObject)this.DataContext;

            var args = new Dictionary<string, object>()
            {
                { "obid", ob.ObjectID },
            };

            var script = "world.GetObject(obid).Destruct()";

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #3
0
        public static void SendSetLivingTraceLevel(LivingObject living, System.Diagnostics.TraceLevel traceLevel)
        {
            var args = new Dictionary <string, object>()
            {
                { "livingID", living.ObjectID },
                { "traceLevel", traceLevel.ToString() },
            };

            var script =
                @"l = world.GetObject(livingID)
t = l.Trace
tl = t.TraceLevel.Parse(t.TraceLevel.GetType(), traceLevel)
t.TraceLevel = tl
";

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #4
0
        private void Move_Button_Click(object sender, RoutedEventArgs e)
        {
            var ob = (MovableObject)this.DataContext;

            var txt = dstTextBox.Text;

            var p = IntVector3.Parse(txt);

            var args = new Dictionary<string, object>()
            {
                { "obid", ob.ObjectID },
                { "p", p },
            };

            var script = "world.GetObject(obid).MoveTo(p)";

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #5
0
        private void Debug_Button_Click(object sender, RoutedEventArgs e)
        {
            var button = (ToggleButton)sender;
            var tag = (string)button.Tag;

            var value = button.IsChecked.GetValueOrDefault();

            var ob = (MovableObject)this.DataContext;

            var args = new Dictionary<string, object>()
            {
                { "obid", ob.ObjectID },
            };

            var script = String.Format("world.GetObject(obid).{0} = {1}", tag, value ? "True" : "False");

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #6
0
        private void Debug_Button_Click(object sender, RoutedEventArgs e)
        {
            var button = (ToggleButton)sender;
            var tag    = (string)button.Tag;

            var value = button.IsChecked.GetValueOrDefault();

            var ob = (MovableObject)this.DataContext;

            var args = new Dictionary <string, object>()
            {
                { "obid", ob.ObjectID },
            };

            var script = String.Format("world.GetObject(obid).{0} = {1}", tag, value ? "True" : "False");

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #7
0
        private void Move_Button_Click(object sender, RoutedEventArgs e)
        {
            var ob = (MovableObject)this.DataContext;

            var txt = dstTextBox.Text;

            var p = IntVector3.Parse(txt);

            var args = new Dictionary <string, object>()
            {
                { "obid", ob.ObjectID },
                { "p", p },
            };

            var script = "world.GetObject(obid).MoveTo(p)";

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #8
0
        public static void SendCreateItem(CreateItemDialog dialog)
        {
            var args = new Dictionary<string, object>()
            {
                { "envID", dialog.Environment.ObjectID },
                { "area", dialog.Area },
                { "itemID", dialog.ItemID },
                { "materialID", dialog.MaterialID },
            };

            var script =
            @"env = world.GetObject(envID)
            for p in area.Range():
            builder = Dwarrowdelf.Server.ItemObjectBuilder(itemID, materialID)
            item = builder.Create(world)
            item.MoveTo(env, p)";

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #9
0
        public static void SendCreateItem(CreateItemDialog dialog)
        {
            var args = new Dictionary <string, object>()
            {
                { "envID", dialog.Environment.ObjectID },
                { "area", dialog.Area },
                { "itemID", dialog.ItemID },
                { "materialID", dialog.MaterialID },
            };

            var script =
                @"env = world.GetObject(envID)
for p in area.Range():
	builder = Dwarrowdelf.Server.ItemObjectBuilder(itemID, materialID)
	item = builder.Create(world)
	item.MoveTo(env, p)"    ;

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #10
0
        private void MoveDir_Button_Click(object sender, RoutedEventArgs e)
        {
            var button = (Button)sender;
            var tag = (string)button.Tag;

            var ob = (MovableObject)this.DataContext;

            var dir = (Direction)Enum.Parse(typeof(Direction), tag);

            var args = new Dictionary<string, object>()
            {
                { "obid", ob.ObjectID },
                { "dir", dir },
            };

            var script = "world.GetObject(obid).MoveDir(dir)";

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #11
0
        private void MoveDir_Button_Click(object sender, RoutedEventArgs e)
        {
            var button = (Button)sender;
            var tag    = (string)button.Tag;

            var ob = (MovableObject)this.DataContext;

            var dir = (Direction)Enum.Parse(typeof(Direction), tag);
            var p   = ob.Location + dir;

            var args = new Dictionary <string, object>()
            {
                { "obid", ob.ObjectID },
                { "p", p },
            };

            var script = "world.GetObject(obid).MoveToMustSucceed(p)";

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #12
0
        public static void SendSetTerrains(SetTerrainDialog dialog, EnvironmentObject env, IntGrid3 cube)
        {
            var data = dialog.Data;

            var args = new Dictionary<string, object>()
            {
                { "envID", env.ObjectID },
                { "cube", cube },
                { "terrainID", data.TerrainID },
                { "terrainMaterialID", data.TerrainMaterialID },
                { "interiorID", data.InteriorID },
                { "interiorMaterialID", data.InteriorMaterialID },
                { "waterLevel", data.Water.HasValue ? (data.Water == true ? (byte?)TileData.MaxWaterLevel : (byte?)0) : null },
            };

            var script =
            @"env = world.GetObject(envID)
            for p in cube.Range():
            td = env.GetTileData(p)

            if terrainID != None:
            Dwarrowdelf.TileData.TerrainID.SetValue(td, terrainID)
            if terrainMaterialID != None:
            Dwarrowdelf.TileData.TerrainMaterialID.SetValue(td, terrainMaterialID)

            if interiorID != None:
            Dwarrowdelf.TileData.InteriorID.SetValue(td, interiorID)
            if interiorMaterialID != None:
            Dwarrowdelf.TileData.InteriorMaterialID.SetValue(td, interiorMaterialID)

            if waterLevel != None:
            Dwarrowdelf.TileData.WaterLevel.SetValue(td, waterLevel)

            env.SetTileData(p, td)

            env.ScanWaterTiles()
            ";
            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #13
0
        public static void SendCreateLiving(CreateLivingDialog dialog)
        {
            var args = new Dictionary<string, object>()
            {
                { "envID", dialog.Environment.ObjectID },
                { "area", dialog.Area },
                { "name", dialog.LivingName },
                { "livingID", dialog.LivingID },
                { "isControllable", dialog.IsControllable },
                { "isGroup", dialog.IsGroup },
            };

            var script =
            @"env = world.GetObject(envID)

            if isGroup:
            group = Dwarrowdelf.AI.Group()

            controllables = [ ]

            for p in area.Range():
            livingBuilder = Dwarrowdelf.Server.LivingObjectBuilder(livingID)
            livingBuilder.Name = name
            living = livingBuilder.Create(world)

            if isControllable:
            engine.GameManager.SetupLivingAsControllable(living)
            else:
            if living.LivingCategory == Dwarrowdelf.LivingCategory.Herbivore:
            ai = Dwarrowdelf.AI.HerbivoreAI(living, 0)
            living.SetAI(ai)

            if isGroup:
                ai.Group = group

            elif living.LivingCategory == Dwarrowdelf.LivingCategory.Carnivore:
            ai = Dwarrowdelf.AI.CarnivoreAI(living, 0)
            living.SetAI(ai)

            elif living.LivingCategory == Dwarrowdelf.LivingCategory.Monster:
            ai = Dwarrowdelf.AI.MonsterAI(living, 0)
            living.SetAI(ai)

            if isControllable:
            controllables.append(living)

            living.MoveTo(env, p);

            for l in controllables:
            player.AddControllable(l)
            ";
            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }
コード例 #14
0
        public static void SendSetLivingTraceLevel(LivingObject living, System.Diagnostics.TraceLevel traceLevel)
        {
            var args = new Dictionary<string, object>()
            {
                { "livingID", living.ObjectID },
                { "traceLevel", traceLevel.ToString() },
            };

            var script =
            @"l = world.GetObject(livingID)
            t = l.Trace
            tl = t.TraceLevel.Parse(t.TraceLevel.GetType(), traceLevel)
            t.TraceLevel = tl
            ";

            var msg = new Dwarrowdelf.Messages.IPScriptMessage(script, args);

            GameData.Data.User.Send(msg);
        }