Exemplo n.º 1
0
        public void ExersiceInsertGetUpdate_SimpleCase_DoesNotThrow()
        {
            BaseAceObject o = new BaseAceObject();

            o.AceObjectId = 1;
            o.Name        = "foo";

            worldDb.ConstructStatement(TestEnum.FooInsert, typeof(BaseAceObject), ConstructedStatementType.Insert);
            worldDb.ConstructStatement(TestEnum.FooUpdate, typeof(BaseAceObject), ConstructedStatementType.Update);
            worldDb.ConstructStatement(TestEnum.FooGet, typeof(BaseAceObject), ConstructedStatementType.Get);

            worldDb.ExecuteConstructedInsertStatement(TestEnum.FooInsert, typeof(BaseAceObject), o);

            BaseAceObject o2 = new BaseAceObject();
            Dictionary <string, object> criteria = new Dictionary <string, object>();

            criteria.Add("baseAceObjectId", 1u);
            worldDb.ExecuteConstructedGetStatement(TestEnum.FooGet, typeof(BaseAceObject), criteria, o2);

            Assert.AreEqual(o.Name, o2.Name);
            Assert.AreEqual(o.AceObjectId, o2.AceObjectId);

            o2.Name = "bar";
            worldDb.ExecuteConstructedUpdateStatement(TestEnum.FooUpdate, typeof(BaseAceObject), o2);

            BaseAceObject o3 = new BaseAceObject();

            worldDb.ExecuteConstructedGetStatement(TestEnum.FooGet, typeof(BaseAceObject), criteria, o3);

            Assert.AreEqual(o2.Name, o3.Name);
        }
Exemplo n.º 2
0
        public BaseAceObject GetBaseAceObjectDataByWeenie(uint weenieClassId)
        {
            var bao      = new BaseAceObject();
            var criteria = new Dictionary <string, object> {
                { "baseAceObjectId", weenieClassId }
            };

            if (!ExecuteConstructedGetStatement(WorldPreparedStatement.GetWeenieClass, typeof(BaseAceObject), criteria, bao))
            {
                return(null);
            }

            foreach (var pal in GetWeeniePalettes(weenieClassId))
            {
                var opal = new PaletteOverride
                {
                    AceObjectId  = pal.WeenieClassId,
                    Length       = pal.Length,
                    Offset       = pal.Offset,
                    SubPaletteId = pal.SubPaletteId
                };
                bao.PaletteOverrides.Add(opal);
            }
            foreach (var tex in GetWeenieTextureMaps(weenieClassId))
            {
                var otex = new TextureMapOverride
                {
                    AceObjectId = tex.WeenieClassId,
                    Index       = tex.Index,
                    NewId       = tex.NewId,
                    OldId       = tex.OldId
                };
                bao.TextureOverrides.Add(otex);
            }
            foreach (var ani in GetWeenieAnimations(weenieClassId))
            {
                var oani = new AnimationOverride
                {
                    AceObjectId = ani.WeenieClassId,
                    AnimationId = ani.AnimationId,
                    Index       = ani.Index
                };
                bao.AnimationOverrides.Add(oani);
            }
            return(bao);
        }