Example #1
0
 public void Parse(GameBitBuffer buffer)
 {
     Min = new Vector3D();
     Min.Parse(buffer);
     Max = new Vector3D();
     Max.Parse(buffer);
 }
Example #2
0
File: AABB.cs Project: Tareg/mooege
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = new Vector3D();
     Field0.Parse(buffer);
     Field1 = new Vector3D();
     Field1.Parse(buffer);
 }
Example #3
0
 public override void Parse(GameBitBuffer buffer)
 {
     Field0 = new Vector3D();
     Field0.Parse(buffer);
     Field1 = buffer.ReadInt(32);
     Field2 = buffer.ReadInt(32);
 }
 public override void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadInt(32);
     if (buffer.ReadBool())
     {
         Position = new Vector3D();
         Position.Parse(buffer);
     }
     if (buffer.ReadBool())
     {
         Field2 = buffer.ReadFloat32();
     }
     if (buffer.ReadBool())
     {
         Field3 = buffer.ReadBool();
     }
     if (buffer.ReadBool())
     {
         Field4 = buffer.ReadFloat32();
     }
     if (buffer.ReadBool())
     {
         Field5 = buffer.ReadInt(24);
     }
     if (buffer.ReadBool())
     {
         Field6 = buffer.ReadInt(21) + (-1);
     }
     if (buffer.ReadBool())
     {
         Field7 = buffer.ReadInt(32);
     }
 }
Example #5
0
 public void Parse(GameBitBuffer buffer)
 {
     Rotation = new Quaternion();
     Rotation.Parse(buffer);
     ReferencePoint = new Vector3D();
     ReferencePoint.Parse(buffer);
 }
 public override void Parse(GameBitBuffer buffer)
 {
     ActorId = buffer.ReadInt(32);
     if (buffer.ReadBool())
     {
         Position = new Vector3D();
         Position.Parse(buffer);
     }
     if (buffer.ReadBool())
     {
         Angle = buffer.ReadFloat32();
     }
     if (buffer.ReadBool())
     {
         Field3 = buffer.ReadBool();
     }
     if (buffer.ReadBool())
     {
         Speed = buffer.ReadFloat32();
     }
     if (buffer.ReadBool())
     {
         Field5 = buffer.ReadInt(24);
     }
     if (buffer.ReadBool())
     {
         AnimationTag = buffer.ReadInt(21) + (-1);
     }
     if (buffer.ReadBool())
     {
         Field7 = buffer.ReadInt(32);
     }
 }
Example #7
0
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = new Quaternion();
     Field0.Parse(buffer);
     ReferencePoint = new Vector3D();
     ReferencePoint.Parse(buffer);
 }
Example #8
0
 public override void Parse(GameBitBuffer buffer)
 {
     EnterPosition = new Vector3D();
     EnterPosition.Parse(buffer);
     WorldID = buffer.ReadUInt(32);
     WorldSNO = buffer.ReadInt(32);
 }
Example #9
0
 public override void Parse(GameBitBuffer buffer)
 {
     ActorID = buffer.ReadInt(32);
     SNOParticleEffect = buffer.ReadInt(32);
     SNOAppearance = buffer.ReadInt(32);
     Field3 = new Vector3D();
     Field3.Parse(buffer);
 }
Example #10
0
 public void Set(Vector3D vec)
 {
     if (vec == null)
         return;
     this.X = vec.X;
     this.Y = vec.Y;
     this.Z = vec.Z;
 }
Example #11
0
 public bool IsWithin(Vector3D v)
 {
     if (v >= this.Min &&
         v <= this.Max)
     {
         return true;
     }
     return false;
 }
Example #12
0
 public override void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadInt(32);
     Field1 = new Vector3D();
     Field1.Parse(buffer);
     Field2 = buffer.ReadInt(24);
     Field3 = buffer.ReadInt(21) + (-1);
     Field4 = buffer.ReadInt(32);
 }
Example #13
0
 protected WorldObject(World world, uint dynamicID)
     : base(dynamicID)
 {
     // Specifically avoid calling the potentially overridden setter for this.World
     this._world = world;
     this._world.Game.StartTracking(this);
     this._rotationAxis = new Vector3D();
     this._position = new Vector3D();
 }
 public void Handle(GameClient client)
 {
     if (PowerSNO != Skills.Monk.SpiritSpenders.BlindingFlash) return;
     var player = client.Player;
     var pos = new Vector3D();
     pos.Z = player.Position.Z;
     for (var i = 0; i < 10; i++)
     {
         pos.X = player.Position.X + (float)RandomHelper.NextDouble() * 20f;
         pos.Y = player.Position.Y + (float)RandomHelper.NextDouble() * 20f;
         player.World.SpawnMob(player, 6652/*SNODatabase.Instance.RandomID(SNOGroup.NPCs)*/, pos);
     }
 }
Example #15
0
        public Proxy(World world, int actorSNO, Vector3D position, float scale = 1.35f)
            : base(world, world.NewActorID)
        {
            this.ActorSNO = actorSNO;
            // FIXME: This is hardcoded crap
            this.Field2 = 0x8;
            this.Field3 = 0x0;
            this.Scale = scale;
            this.Position.Set(position);
            this.RotationAmount = scale;
            this.RotationAxis.X = 0f;
            this.RotationAxis.Y = 0f;
            this.RotationAxis.Z = 1f;
            this.GBHandle.Type = (int)GBHandleType.Monster; this.GBHandle.GBID = 1;
            this.Field7 = 0x00000001;
            this.Field8 = this.ActorSNO;
            this.Field10 = 0x0;
            this.Field11 = 0x0;
            this.Field12 = 0x0;
            this.Field13 = 0x0;
            this.AnimationSNO = 0x11150;

            this.Attributes[GameAttribute.Untargetable] = false;
            this.Attributes[GameAttribute.Uninterruptible] = true;
            this.Attributes[GameAttribute.Buff_Visual_Effect, 1048575] = true;
            this.Attributes[GameAttribute.Buff_Icon_Count0, 30582] = 1;
            this.Attributes[GameAttribute.Buff_Icon_Count0, 30286] = 1;
            this.Attributes[GameAttribute.Buff_Icon_Count0, 30285] = 1;
            this.Attributes[GameAttribute.Buff_Icon_Count0, 30284] = 1;
            this.Attributes[GameAttribute.Buff_Icon_Count0, 30283] = 1;
            this.Attributes[GameAttribute.Buff_Icon_Count0, 30290] = 1;
            this.Attributes[GameAttribute.Buff_Icon_Count0, 79486] = 1;
            this.Attributes[GameAttribute.Buff_Active, 30286] = true;
            this.Attributes[GameAttribute.Buff_Active, 30285] = true;
            this.Attributes[GameAttribute.Buff_Active, 30284] = true;
            this.Attributes[GameAttribute.Buff_Active, 30283] = true;
            this.Attributes[GameAttribute.Buff_Active, 30290] = true;

            this.Attributes[GameAttribute.Hitpoints_Max_Total] = 4.546875f;
            this.Attributes[GameAttribute.Buff_Active, 79486] = true;
            this.Attributes[GameAttribute.Hitpoints_Max] = 4.546875f;
            this.Attributes[GameAttribute.Hitpoints_Total_From_Level] = 0f;
            this.Attributes[GameAttribute.Hitpoints_Cur] = 4.546875f;
            this.Attributes[GameAttribute.Invulnerable] = true;
            this.Attributes[GameAttribute.Buff_Active, 30582] = true;
            this.Attributes[GameAttribute.TeamID] = 10;
            this.Attributes[GameAttribute.Level] = 1;

            this.World.Enter(this); // Enter only once all fields have been initialized to prevent a run condition
        }
 public override void Parse(GameBitBuffer buffer)
 {
     ActorId = buffer.ReadInt(32);
     Start = new Vector3D();
     Start.Parse(buffer);
     Velocity = new Vector3D();
     Velocity.Parse(buffer);
     Field3 = buffer.ReadInt(24);
     FlyingAnimationTagID = buffer.ReadInt(21) + (-1);
     LandingAnimationTagID = buffer.ReadInt(21) + (-1);
     Field6 = buffer.ReadFloat32();
     Field7 = buffer.ReadInt(32);
     Field8 = buffer.ReadFloat32();
 }
Example #17
0
 public override void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadInt(32);
     Field1 = buffer.ReadInt(32);
     Field2 = buffer.ReadInt(32);
     Field3 = new Vector3D();
     Field3.Parse(buffer);
     Field4 = new Vector3D();
     Field4.Parse(buffer);
     Field5 = buffer.ReadFloat32();
     Field6 = buffer.ReadFloat32();
     Field7 = buffer.ReadInt(32);
     Field8 = new RGBAColor();
     Field8.Parse(buffer);
     Field9 = buffer.ReadCharArray(128);
 }
Example #18
0
        public Portal(World world)
            : base(world, world.NewActorID)
        {
            this.Destination = new ResolvedPortalDestination();
            this.Destination.WorldSNO = -1;
            this.Destination.DestLevelAreaSNO = -1;
            this.TargetPos = new Vector3D();

            // FIXME: Hardcoded crap
            this.Attributes[GameAttribute.MinimapActive] = true;
            this.Attributes[GameAttribute.Hitpoints_Max_Total] = 1f;
            this.Attributes[GameAttribute.Hitpoints_Max] = 0.0009994507f;
            this.Attributes[GameAttribute.Hitpoints_Total_From_Level] = 3.051758E-05f;
            this.Attributes[GameAttribute.Hitpoints_Cur] = 0.0009994507f;
            this.Attributes[GameAttribute.TeamID] = 1;
            this.Attributes[GameAttribute.Level] = 1;

            this.World.Enter(this); // Enter only once all fields have been initialized to prevent a run condition
        }
Example #19
0
        // Updated based on BoyC's 010editoer template, looks like some data at the end still isnt parsed - Darklotus
        public Actor(MpqFile file)
        {
            var stream = file.Open();
            stream.Seek(16, SeekOrigin.Begin);
            this.ActorSNO = stream.ReadInt32();
            stream.Position += 8; // pad 2;
            this.i0 = stream.ReadInt32();
            this.Type = stream.ReadInt32();
            this.ApperanceSNO = stream.ReadInt32();
            this.snoPhysMesh = stream.ReadInt32();
            this.Cyl = new AxialCylinder(stream);
            this.s = new Sphere(stream);
            this.aabbBounds = new AABB(stream);
            this.serTagMap = new SerializeData(stream);
            stream.Position += 8; // pad 2
            this.AnimSetSNO = stream.ReadInt32();
            this.MonsterSNO = stream.ReadInt32();
            this.serMsgTriggeredEvents = new SerializeData(stream);

            this.i1 = stream.ReadInt32();
            stream.Position += 12; // pad 3 int - DarkLotus
            this.v0 = new Vector3D(stream.ReadFloat(), stream.ReadFloat(), stream.ReadFloat());
            this.Looks = new WeightedLook[8];
            for (int i = 0; i < 8; i++)
            {
                this.Looks[i] = new WeightedLook(stream);
            }
            this.PhysicsSNO = stream.ReadInt32();
            this.i2 = stream.ReadInt32(); this.i3 = stream.ReadInt32();
            this.f0 = stream.ReadFloat(); this.f1 = stream.ReadFloat(); this.f2 = stream.ReadFloat();
            this.padActorCollisionData = new int[17]; // Was 68/4 - Darklotus 
            for (int i = 0; i < 17; i++)
            {
                this.padActorCollisionData[i] = stream.ReadInt32();
            }
            this.padInventoryImages = new int[10]; //Was 5*8/4 - Darklotus
            for (int i = 0; i < 10; i++)
            {
                this.padInventoryImages[i] = stream.ReadInt32();
            }
            stream.Close();
        }
 public override void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadInt(32);
     Field1 = buffer.ReadInt(4);
     Field2 = buffer.ReadInt(32);
     Field3 = buffer.ReadInt(32);
     Field4 = new Vector3D();
     Field4.Parse(buffer);
     Field5 = buffer.ReadFloat32();
     Field6 = new Vector3D();
     Field6.Parse(buffer);
     Field7 = buffer.ReadInt(32);
     Field8 = buffer.ReadInt(32);
     Field9 = buffer.ReadInt(32);
     Field10 = buffer.ReadInt(32);
     Field11 = buffer.ReadInt(32);
     Field12 = buffer.ReadFloat32();
     Field13 = buffer.ReadFloat32();
     Field14 = buffer.ReadFloat32();
     Field15 = buffer.ReadFloat32();
 }
Example #21
0
        public string Spawn(string[] @params, MooNetClient invokerClient)
        {
            if (invokerClient == null)
                return "You can not invoke this command from console.";

            if (invokerClient.InGameClient == null)
                return "You can only invoke this command while ingame.";

            var player = invokerClient.InGameClient.Player;
            var actorSNO = 6652; /* zombie */
            var amount = 1;


            if (@params != null)
            {
                if (!Int32.TryParse(@params[0], out amount))
                    amount = 1;

                if (amount > 100) amount = 100;

                if (@params.Count() > 1)
                    if (!Int32.TryParse(@params[1], out actorSNO))
                        actorSNO = 6652;
            }

            for (int i = 0; i < amount; i++)
            {
                var position = new Vector3D(player.Position.X + (float) RandomHelper.NextDouble()*20f,
                                            player.Position.Y + (float) RandomHelper.NextDouble()*20f,
                                            player.Position.Z);

                player.World.SpawnMob(player, actorSNO, position);
            }

            return string.Format("Spawned {0} mobs with ActorSNO: {1}", amount, actorSNO);
        }
Example #22
0
        public override string Invoke(string parameters, MooNetClient invokerClient = null)
        {
            if (invokerClient == null)
                return "You can not invoke this command from console.";
            
            if (invokerClient.InGameClient == null) 
                return "You can only invoke this command while ingame.";

            var player = invokerClient.InGameClient.Player;
            var actorSNO = 6652; /* zombie */
            var amount = 1;

            var @params = parameters.Split(' ');
            if(@params.Count()<1)
                return "Invalid arguments. Type 'help spawn' to get help.";

            if (!Int32.TryParse(@params[0], out amount))
                amount = 1;

            if (amount > 100) amount = 100;
            
            if(@params.Count()>1)
                if (!Int32.TryParse(@params[1], out actorSNO))
                    actorSNO = 6652;

            for(int i=0;i<amount;i++)
            {
                var position = new Vector3D(player.Position.X + (float) RandomHelper.NextDouble()*20f,
                                            player.Position.Y + (float) RandomHelper.NextDouble()*20f, 
                                            player.Position.Z);

                player.World.SpawnMob(player, actorSNO, position);
            }

            return string.Format("Spawned {0} mobs with ActorSNO: {1}", amount, actorSNO);
        }
Example #23
0
        public IList<Actor> FindActorsInFront(Actor refActor, Vector3D targetPos, float degOpening, float maxDistance, int maxCount = -1)
        {
            List<Actor> actors = new List<Actor>();

            //Restrict calculation to actor that are in range radiux
            List<Actor> targets = refActor.World.GetActorsInRange(refActor.Position, maxDistance);

            float deg_ref = this.fx.getDeg(refActor.Position, targetPos);

            foreach (Actor actor in targets)
            {
                if (actors.Count == maxCount)
                    break;

                //Calculate deg
                float deg_target = this.fx.getDeg(refActor.Position, actor.Position);

                float deg_upper_limit = (deg_ref + degOpening / 2);
                float deg_lower_limit = (deg_ref - degOpening / 2);

                //Correction need to be made when 0 deg is in the cone
                if (deg_upper_limit > 360f || deg_lower_limit < 0)
                {
                    deg_upper_limit += 360f;
                    deg_lower_limit += 360f;
                    deg_target += 360f;
                }

                if ((deg_upper_limit > deg_target) && (deg_lower_limit < deg_target))
                {
                    actors.Add(actor);
                }

            }
            return actors;
        }
Example #24
0
        public void ChangeToonWorld(GameClient client, int WorldID, Vector3D Pos)
        {
            Hero hero = client.Player.Hero;

            World newworld = null;
            //don't use getworld() here as that'd create a new empty world anyway
            foreach (var x in _worlds)
                if (x.WorldID == WorldID)
                    newworld = x;

            World currentworld = null;
            //don't use getworld() here as that'd create a new empty world anyway
            foreach (var x in _worlds)
                if (x.WorldID == hero.WorldId)
                    currentworld = x;
            
            if (newworld == null || currentworld==null) return; //don't go to a world we don't have in the universe

            currentworld.DestroyWorld(hero);

            hero.WorldId = newworld.WorldID;
            hero.CurrentWorldSNO = newworld.WorldSNO;
            hero.Position.X = Pos.X;
            hero.Position.Y = Pos.Y;
            hero.Position.Z = Pos.Z;

            newworld.Reveal(hero);

            client.SendMessage(new ACDWorldPositionMessage
            {
                Id = 0x3f,
                Field0 = 0x789E00E2,
                Field1 = new WorldLocationMessageData
                {
                    Field0 = 1.43f,
                    Field1 = new PRTransform
                    {
                        Field0 = new Quaternion
                        {
                            Amount = 0.05940768f,
                            Axis = new Vector3D
                            {
                                X = 0f,
                                Y = 0f,
                                Z = 0.9982339f,
                            }
                        },
                        ReferencePoint = hero.Position,
                    },
                    Field2 = newworld.WorldID,
                }
            });

            client.FlushOutgoingBuffer();

            client.SendMessage(new PlayerWarpedMessage()
            {
                Id = 0x0B1,
                Field0 = 9,
                Field1 = 0f,
            });

            client.PacketId += 40 * 2;
            client.SendMessage(new DWordDataMessage()
            {
                Id = 0x89,
                Field0 = client.PacketId,
            });

            client.FlushOutgoingBuffer();
        }
Example #25
0
        public bool ParseFrom(int worldId, string line)
        {
            var data = line.Split(' ');

            if (int.Parse(data[2]) == 0) return false; //skip inventory using items as their use is unknown

            this.WorldId = worldId;

            this.DynamicId = int.Parse(data[4]);
            this.SnoId = int.Parse(data[5]);
            this.Field2 = int.Parse(data[6]);
            this.Field3 = int.Parse(data[7]);

            if (int.Parse(data[2]) > 0)
            {
                this.Scale = float.Parse(data[8], System.Globalization.CultureInfo.InvariantCulture);
                this.RotationAmount = float.Parse(data[12], System.Globalization.CultureInfo.InvariantCulture);
                this.RotationAxis = new Vector3D()
                                        {
                                            X = float.Parse(data[9], System.Globalization.CultureInfo.InvariantCulture),
                                            Y = float.Parse(data[10], System.Globalization.CultureInfo.InvariantCulture),
                                            Z = float.Parse(data[11], System.Globalization.CultureInfo.InvariantCulture),
                                        };

                this.Position = new Vector3D()
                                    {
                                        X = float.Parse(data[13], System.Globalization.CultureInfo.InvariantCulture),
                                        Y = float.Parse(data[14], System.Globalization.CultureInfo.InvariantCulture),
                                        Z = float.Parse(data[15], System.Globalization.CultureInfo.InvariantCulture),
                                    };
            }

            // data[14] = world_id

            if (int.Parse(data[3]) > 0)
            {
                this.InventoryLocationData = new InventoryLocationMessageData()
                {
                    Field0 = int.Parse(data[17]),
                    Field1 = int.Parse(data[18]),
                    Field2 = new IVector2D()
                    {
                        Field0 = int.Parse(data[19]),
                        Field1 = int.Parse(data[20]),
                    }
                };
            }

            this.GBHandle = new GBHandle()
            {
                Field0 = int.Parse(data[21]),
                Field1 = int.Parse(data[22]),
            };

            this.Field7 = int.Parse(data[23]);
            this.Field8 = int.Parse(data[24]);
            this.Field9 = int.Parse(data[25]);
            this.Field10 = byte.Parse(data[26]);

            return true;
        }
Example #26
0
 public void Parse(GameBitBuffer buffer)
 {
     Amount = buffer.ReadFloat32();
     Axis = new Vector3D();
     Axis.Parse(buffer);
 }
Example #27
0
        public Actor(MpqFile file)
        {
            var stream = file.Open();
            Header = new Header(stream);

            this.Int0 = stream.ReadValueS32();
            this.Type = (ActorType)stream.ReadValueS32();
            this.ApperanceSNO = stream.ReadValueS32();
            this.PhysMeshSNO = stream.ReadValueS32();
            this.Cylinder = new AxialCylinder(stream);
            this.Sphere = new Sphere(stream);
            this.AABBBounds = new AABB(stream);

            var tagmap = stream.GetSerializedDataPointer(); // we need to read tagmap. /raist.
            stream.Position += (2*4);

            this.AnimSetSNO = stream.ReadValueS32();
            this.MonsterSNO = stream.ReadValueS32();

            var msgTriggeredEvents = stream.GetSerializedDataPointer();

            this.Int1 = stream.ReadValueS32();
            stream.Position += (3*4);
            this.V0 = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());

            this.Looks = new WeightedLook[8];
            for (int i = 0; i < 8; i++)
            {
                this.Looks[i] = new WeightedLook(stream);
            }

            this.PhysicsSNO = stream.ReadValueS32();
            this.Int2 = stream.ReadValueS32();
            this.Int3 = stream.ReadValueS32();
            this.Float0 = stream.ReadValueF32();
            this.Float1 = stream.ReadValueF32();
            this.Float2 = stream.ReadValueF32();

            this.ActorCollisionData = new int[17]; // Was 68/4 - Darklotus 
            for (int i = 0; i < 17; i++)
            {
                this.ActorCollisionData[i] = stream.ReadValueS32();
            }

            this.InventoryImages = new int[10]; //Was 5*8/4 - Darklotus
            for (int i = 0; i < 10; i++)
            {
                this.InventoryImages[i] = stream.ReadValueS32();
            }

            // Updated based on BoyC's 010editoer template, looks like some data at the end still isnt parsed - Darklotus
            stream.Close();
        }
Example #28
0
 public Sphere(MpqFileStream stream)
 {
     Position = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
     Radius = stream.ReadValueF32();
 }
Example #29
0
 public AxialCylinder(MpqFileStream stream)
 {
     this.Position = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32());
     Ax1 = stream.ReadValueF32();
     Ax2 = stream.ReadValueF32();
 }
Example #30
0
File: Item.cs Project: moack/mooege
 public void Drop(Mooege.Core.GS.Player.Player owner, Vector3D position)
 {
     this.Owner = owner;
     this.Position = position;
     // TODO: Notify the world so that players get the state change
 }