示例#1
0
        public Player(bool fullSim = false)
        {
            FullSim = fullSim;

            WorldObject      = new ACE.Server.WorldObjects.Player();
            WorldObject.Name = "Player";
            //worldObj.RunSkill = runSkill;
            //worldObj.IsCreature = true;

            WorldObject.Strength.StartingValue     = 400;
            WorldObject.Endurance.StartingValue    = 400;
            WorldObject.Coordination.StartingValue = 400;
            WorldObject.Quickness.StartingValue    = 400;
            WorldObject.Focus.StartingValue        = 400;
            WorldObject.Self.StartingValue         = 400;

            var run = WorldObject.GetCreatureSkill(Skill.Run);

            run.InitLevel = 100;

            var jump = WorldObject.GetCreatureSkill(Skill.Jump);

            jump.InitLevel = 450;

            WorldObject.PhysicsObj = new PhysicsObj();
            PhysicsObj.set_object_guid(new ACE.Entity.ObjectGuid(NextPlayerGuid++));

            // player
            uint modelID  = 0x02000001;
            uint mTableID = 0x09000001;
            //uint runSkill = 300;
            float scale = 1.0f;

            PhysicsObj.makeAnimObject(modelID, true);

            var weenie = new WeenieObject(WorldObject);

            PhysicsObj.set_weenie_obj(weenie);

            PhysicsObj.SetMotionTableID(mTableID);
            PhysicsObj.SetScaleStatic(scale);

            if (!fullSim)
            {
                PhysicsObj.ParticleManager = new ParticleManager();
            }

            RawMotionState = new RawMotionState();
            RawMotionState.CurrentHoldKey = HoldKey.Run;
        }
示例#2
0
        public void DoStance(MotionStance stance)
        {
            var rawState = new RawMotionState();

            rawState.CurrentStyle   = (uint)stance;
            rawState.ForwardCommand = (uint)MotionCommand.Ready;
            rawState.CurrentHoldKey = HoldKey.Run;

            var motionInterp = PhysicsObj.get_minterp();

            motionInterp.RawState = rawState;
            motionInterp.apply_raw_movement(true, true);

            //if (PhysicsObj.PartArray.MotionTableManager.PendingAnimations.Count() > 0)
            //Console.WriteLine("Motions pending");
        }
示例#3
0
        public static MoveToState read(BinaryReader binaryReader)
        {
            MoveToState newObj = new MoveToState();

            newObj.raw_motion_state         = RawMotionState.read(binaryReader);
            newObj.position                 = Position.read(binaryReader);
            newObj.instance_timestamp       = binaryReader.ReadUInt16();
            newObj.server_control_timestamp = binaryReader.ReadUInt16();
            newObj.teleport_timestamp       = binaryReader.ReadUInt16();
            newObj.force_position_ts        = binaryReader.ReadUInt16();

            byte flags = binaryReader.ReadByte();

            newObj.contact       = (flags & (1 << 0)) != 0;
            newObj.longjump_mode = (flags & (1 << 1)) != 0;

            Util.readToAlign(binaryReader);

            return(newObj);
        }
示例#4
0
        public static RawMotionState read(BinaryReader binaryReader)
        {
            RawMotionState newObj = new RawMotionState();

            newObj.bitfield = binaryReader.ReadUInt32();
            if ((newObj.bitfield & (uint)PackBitfield.current_holdkey) != 0)
            {
                newObj.current_holdkey = (HoldKey)binaryReader.ReadUInt32();
            }
            if ((newObj.bitfield & (uint)PackBitfield.current_style) != 0)
            {
                newObj.current_style = (MotionStyle)binaryReader.ReadUInt32();
            }
            if ((newObj.bitfield & (uint)PackBitfield.forward_command) != 0)
            {
                newObj.forward_command = (MotionStyle)binaryReader.ReadUInt32();
            }
            if ((newObj.bitfield & (uint)PackBitfield.forward_holdkey) != 0)
            {
                newObj.forward_holdkey = (HoldKey)binaryReader.ReadUInt32();
            }
            if ((newObj.bitfield & (uint)PackBitfield.forward_speed) != 0)
            {
                newObj.forward_speed = binaryReader.ReadSingle();
            }
            if ((newObj.bitfield & (uint)PackBitfield.sidestep_command) != 0)
            {
                newObj.sidestep_command = (MotionStyle)binaryReader.ReadUInt32();
            }
            if ((newObj.bitfield & (uint)PackBitfield.sidestep_holdkey) != 0)
            {
                newObj.sidestep_holdkey = (HoldKey)binaryReader.ReadUInt32();
            }
            if ((newObj.bitfield & (uint)PackBitfield.sidestep_speed) != 0)
            {
                newObj.sidestep_speed = binaryReader.ReadSingle();
            }
            if ((newObj.bitfield & (uint)PackBitfield.turn_command) != 0)
            {
                newObj.turn_command = (MotionStyle)binaryReader.ReadUInt32();
            }
            if ((newObj.bitfield & (uint)PackBitfield.turn_holdkey) != 0)
            {
                newObj.turn_holdkey = (HoldKey)binaryReader.ReadUInt32();
            }
            if ((newObj.bitfield & (uint)PackBitfield.turn_speed) != 0)
            {
                newObj.turn_speed = binaryReader.ReadSingle();
            }

            uint numActions = (newObj.bitfield >> 11);

            for (int i = 0; i < numActions; ++i)
            {
                // TODO: Do actual stuff here!
                uint thing1 = command_ids[binaryReader.ReadUInt16()];
                uint thing2 = binaryReader.ReadUInt16();
                uint thing3 = binaryReader.ReadUInt32();
            }

            Util.readToAlign(binaryReader);

            return(newObj);
        }
示例#5
0
        public static RawMotionState read(BinaryReader binaryReader)
        {
            RawMotionState newObj = new RawMotionState();

            newObj.packedItems = new List <string>();
            newObj.bitfield    = binaryReader.ReadUInt32();
            if ((newObj.bitfield & (uint)PackBitfield.current_holdkey) != 0)
            {
                newObj.current_holdkey = (uint)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PackBitfield.current_holdkey.ToString());
            }
            if ((newObj.bitfield & (uint)PackBitfield.current_style) != 0)
            {
                newObj.current_style = (uint)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PackBitfield.current_style.ToString());
            }
            if ((newObj.bitfield & (uint)PackBitfield.forward_command) != 0)
            {
                newObj.forward_command = (uint)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PackBitfield.forward_command.ToString());
            }
            if ((newObj.bitfield & (uint)PackBitfield.forward_holdkey) != 0)
            {
                newObj.forward_holdkey = (uint)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PackBitfield.forward_holdkey.ToString());
            }
            if ((newObj.bitfield & (uint)PackBitfield.forward_speed) != 0)
            {
                newObj.forward_speed = binaryReader.ReadSingle();
                newObj.packedItems.Add(PackBitfield.forward_speed.ToString());
            }
            if ((newObj.bitfield & (uint)PackBitfield.sidestep_command) != 0)
            {
                newObj.sidestep_command = (uint)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PackBitfield.sidestep_command.ToString());
            }
            if ((newObj.bitfield & (uint)PackBitfield.sidestep_holdkey) != 0)
            {
                newObj.sidestep_holdkey = (uint)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PackBitfield.sidestep_holdkey.ToString());
            }
            if ((newObj.bitfield & (uint)PackBitfield.sidestep_speed) != 0)
            {
                newObj.sidestep_speed = binaryReader.ReadSingle();
                newObj.packedItems.Add(PackBitfield.sidestep_speed.ToString());
            }
            if ((newObj.bitfield & (uint)PackBitfield.turn_command) != 0)
            {
                newObj.turn_command = (uint)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PackBitfield.turn_command.ToString());
            }
            if ((newObj.bitfield & (uint)PackBitfield.turn_holdkey) != 0)
            {
                newObj.turn_holdkey = (uint)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PackBitfield.turn_holdkey.ToString());
            }
            if ((newObj.bitfield & (uint)PackBitfield.turn_speed) != 0)
            {
                newObj.turn_speed = binaryReader.ReadSingle();
                newObj.packedItems.Add(PackBitfield.turn_speed.ToString());
            }

            uint num_actions = (newObj.bitfield >> 11);

            newObj.packedItems.Add("num_actions = " + num_actions);
            newObj.actions = new List <ActionNode>();
            for (int i = 0; i < num_actions; ++i)
            {
                newObj.actions.Add(ActionNode.read(binaryReader));
            }

            Util.readToAlign(binaryReader);

            return(newObj);
        }