Esempio n. 1
0
        public ViewObject(uint setupID)
        {
            PhysicsObj = new PhysicsObj();

            var guid = new ACE.Entity.ObjectGuid(NextGuid++);

            PhysicsObj.set_object_guid(guid);

            uint modelID = setupID;

            //uint runSkill = 300;
            float scale = 1.0f;

            if (modelID >> 24 == 0x1)
            {
                PhysicsObj = PhysicsObj.makeObject(modelID, guid.Full, false);
            }
            else
            {
                PhysicsObj.makeAnimObject(modelID, true);
            }

            // fake contact / on ground
            PhysicsObj.TransientState |= TransientStateFlags.Contact | TransientStateFlags.OnWalkable;

            // fake cell
            PhysicsObj.CurCell = new ObjCell();

            var worldObj = new WorldObject();
            //worldObj.Name = $"Obj {setupID:X8}";
            //worldObj.RunSkill = runSkill;
            //worldObj.IsCreature = true;

            var weenie = new WeenieObject(worldObj);

            PhysicsObj.set_weenie_obj(weenie);

            var didTable = DIDTables.Get(setupID);

            if (didTable != null)
            {
                var mTableID = didTable.MotionTableID;
                PhysicsObj.SetMotionTableID(mTableID);
            }

            PhysicsObj.SetScaleStatic(scale);

            PhysicsObj.set_initial_frame(new AFrame());
        }
Esempio n. 2
0
        public void OnClickSetup(uint fileID)
        {
            // get motion table for this setup
            // this mapping is not stored in the client data, and is derived from the server databases
            MotionStances.Items.Clear();
            MotionCommands.Items.Clear();

            uint mtableID = 0;
            var  didTable = DIDTables.Get(fileID);

            if (didTable == null)
            {
                // maybe it's stored in Setup.DefaultMotionTable?
                mtableID = ModelViewer.Setup?.Setup?._setup?.DefaultMotionTable ?? 0;
            }
            else
            {
                mtableID = didTable.MotionTableID;
            }

            if (mtableID == 0)
            {
                return;
            }

            MainWindow.Status.WriteLine($"Motion table: {mtableID:X8}");

            MotionTable = new FileTypes.MotionTable(DatManager.PortalDat.ReadFromDat <ACE.DatLoader.FileTypes.MotionTable>(mtableID));

            var stances = MotionTable.GetStances();

            SetStances(stances);

            var commands = MotionTable.GetMotionCommands();

            SetCommands(commands);

            SetDefaultStance();
        }