Beispiel #1
0
 private void TBFieldData_TextChanged(object sender, EventArgs e)
 {
     FieldData.Clear();
     if (TBFieldData.Text == "")
     {
         LFieldWarning.Text = "";
     }
     else
     {
         try
         {
             var splittedDatas = TBFieldData.Text.Replace(" ", "").Split(',').ToList();
             foreach (var si in splittedDatas)
             {
                 FieldData.Add(Convert.ChangeType(si, FieldType.FieldType));
             }
             LFieldWarning.Text = "";
         }
         catch (Exception ex)
         {
             LFieldWarning.Text = ex.Message;
         }
     }
 }
Beispiel #2
0
        public override IPacketWriter BuildUpdate()
        {
            MaskSize = ((int)Fields.MAX + 31) / 32;
            FieldData.Clear();
            MaskArray = new byte[MaskSize * 4];

            PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_UPDATE_OBJECT], "SMSG_UPDATE_OBJECT");

            writer.WriteUInt32(1); // Number of transactions
            writer.WriteUInt8(0);

            writer.WriteUInt8(3);       // UpdateType
            writer.WritePackedGUID(Guid);
            writer.WriteUInt8(4);       // ObjectType, 4 = Player

            writer.WriteUInt8(0x71);    // UpdateFlags
            writer.WriteUInt32(0x2000); // MovementFlagMask
            writer.WriteUInt32((uint)Environment.TickCount);

            writer.WriteFloat(Location.X); // x
            writer.WriteFloat(Location.Y); // y
            writer.WriteFloat(Location.Z); // z
            writer.WriteFloat(Location.O); // w (o)
            writer.WriteInt32(0);          // falltime

            writer.WriteFloat(0);
            writer.WriteFloat(1);
            writer.WriteFloat(0);
            writer.WriteFloat(0);

            writer.WriteFloat(2.5f);    // WalkSpeed
            writer.WriteFloat(7.0f);    // RunSpeed
            writer.WriteFloat(2.5f);    // Backwards WalkSpeed
            writer.WriteFloat(4.7222f); // SwimSpeed
            writer.WriteFloat(4.7222f); // Backwards SwimSpeed
            writer.WriteFloat(7.0f);    // FlySpeed
            writer.WriteFloat(4.7222f); // Backwards FlySpeed
            writer.WriteFloat(3.14f);   // TurnSpeed

            writer.Write(1);

            SetField(Fields.OBJECT_FIELD_GUID, Guid);
            SetField(Fields.OBJECT_FIELD_TYPE, (uint)0x19);
            SetField(Fields.OBJECT_FIELD_ENTRY, 0);
            SetField(Fields.OBJECT_FIELD_SCALE_X, Scale);
            SetField(Fields.OBJECT_FIELD_PADDING, 0);
            SetField(Fields.UNIT_FIELD_TARGET, (ulong)0);
            SetField(Fields.UNIT_FIELD_HEALTH, Health);
            SetField(Fields.UNIT_FIELD_POWER2, 0);
            SetField(Fields.UNIT_FIELD_MAXHEALTH, Health);
            SetField(Fields.UNIT_FIELD_MAXPOWER2, Rage);
            SetField(Fields.UNIT_FIELD_LEVEL, Level);
            SetField(Fields.UNIT_FIELD_FACTIONTEMPLATE, this.GetFactionTemplate());
            SetField(Fields.UNIT_FIELD_BYTES_0, ToUInt32(Race, Class, Gender, PowerType));
            SetField(Fields.UNIT_FIELD_STAT0, Strength);
            SetField(Fields.UNIT_FIELD_STAT1, Agility);
            SetField(Fields.UNIT_FIELD_STAT2, Stamina);
            SetField(Fields.UNIT_FIELD_STAT3, Intellect);
            SetField(Fields.UNIT_FIELD_STAT4, Spirit);
            SetField(Fields.UNIT_FIELD_FLAGS, 8);
            SetField(Fields.UNIT_FIELD_BASE_MANA, Mana);
            SetField(Fields.UNIT_FIELD_DISPLAYID, DisplayId);
            SetField(Fields.UNIT_FIELD_MOUNTDISPLAYID, MountDisplayId);
            SetField(Fields.UNIT_FIELD_BYTES_1, ToUInt32((byte)StandState));
            SetField(Fields.UNIT_FIELD_BYTES_2, 0);
            SetField(Fields.PLAYER_BYTES, ToUInt32(Skin, Face, HairStyle, HairColor));
            SetField(Fields.PLAYER_BYTES_2, ToUInt32(FacialHair, b4: RestedState));
            SetField(Fields.PLAYER_BYTES_3, ToUInt32(Gender));
            SetField(Fields.PLAYER_XP, 47);
            SetField(Fields.PLAYER_NEXT_LEVEL_XP, 200);
            SetField(Fields.PLAYER_FLAGS, 0);

            SetField(Fields.UNIT_FIELD_ATTACK_POWER, 1);
            SetField(Fields.UNIT_FIELD_ATTACK_POWER_MODS, 0);
            SetField(Fields.UNIT_FIELD_RANGED_ATTACK_POWER, 1);
            SetField(Fields.UNIT_FIELD_RANGED_ATTACK_POWER_MODS, 0);

            for (int i = 0; i < 64; i++)
            {
                SetField(Fields.PLAYER_EXPLORED_ZONES_1 + i, 0xFFFFFFFF);
            }

            // FillInPartialObjectData
            writer.WriteUInt8(MaskSize); // UpdateMaskBlocks
            writer.Write(MaskArray);
            foreach (var kvp in FieldData)
            {
                writer.Write(kvp.Value); // Data
            }
            return(writer);
        }
Beispiel #3
0
        public override IPacketWriter BuildUpdate()
        {
            MaskSize = ((int)Fields.MAX + 31) / 32;
            FieldData.Clear();
            MaskArray = new byte[MaskSize * 4];

            PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_UPDATE_OBJECT], "SMSG_UPDATE_OBJECT");

            writer.WriteUInt32(1);         // Number of transactions
            writer.WriteUInt8(2);          // UpdateType
            writer.WriteUInt64(Guid);      // ObjectGuid
            writer.WriteUInt8(4);          // ObjectType, 4 = Player

            writer.WriteUInt32(0);         // MovementFlagMask
            writer.WriteFloat(Location.X); // x
            writer.WriteFloat(Location.Y); // y
            writer.WriteFloat(Location.Z); // z
            writer.WriteFloat(Location.O); // w (o)
            writer.WriteFloat(2.5f);       // WalkSpeed
            writer.WriteFloat(7.0f);       // RunSpeed
            writer.WriteFloat(4.7222f);    // SwimSpeed
            writer.WriteFloat(3.14f);      // TurnSpeed

            writer.WriteUInt32(1);         // Flags, 1 - Player
            writer.WriteUInt32(1);         // AttackCycle
            writer.WriteUInt32(0);         // TimerId
            writer.WriteUInt64(0);         // VictimGuid

            SetField(Fields.GUID, Guid);
            SetField(Fields.HIER_TYPE, (uint)0x19);
            SetField(Fields.ENTRY, 0);
            SetField(Fields.SCALE, Scale);
            SetField(Fields.TARGET, (ulong)0);
            SetField(Fields.HEALTH, Health);
            SetField(Fields.MANA, Mana);
            SetField(Fields.RAGE, 0);
            SetField(Fields.FOCUS, Focus);
            SetField(Fields.ENERGY, Energy);
            SetField(Fields.MAX_HEALTH, Health);
            SetField(Fields.MAX_MANA, Mana);
            SetField(Fields.MAX_RAGE, Rage);
            SetField(Fields.MAX_FOCUS, Focus);
            SetField(Fields.MAX_ENERGY, Energy);
            SetField(Fields.LEVEL, Level);
            SetField(Fields.FACTION, 35);
            SetField(Fields.UNIT_BYTES_0, ToUInt32(Race, Class, Gender, PowerType));
            SetField(Fields.STRENGTH, Strength);
            SetField(Fields.AGILITY, Agility);
            SetField(Fields.STAMINA, Stamina);
            SetField(Fields.INTELLECT, Intellect);
            SetField(Fields.SPIRIT, Spirit);
            SetField(Fields.BASE_STRENGTH, Strength);
            SetField(Fields.BASE_AGILITY, Agility);
            SetField(Fields.BASE_STAMINA, Stamina);
            SetField(Fields.BASE_INTELLECT, Intellect);
            SetField(Fields.BASE_SPIRIT, Spirit);
            SetField(Fields.FLAGS, 0);
            SetField(Fields.DISPLAYID, DisplayId);
            SetField(Fields.MOUNT_DISPLAYID, MountDisplayId);
            SetField(Fields.UNIT_BYTES_1, ToUInt32((byte)StandState));
            SetField(Fields.SELECTION, (ulong)0);
            SetField(Fields.PLAYER_BYTES_1, ToUInt32(Skin, Face, HairStyle, HairColor));
            SetField(Fields.PLAYER_BYTES_2, ToUInt32(b2: FacialHair, b4: RestedState));
            SetField(Fields.XP, 47);
            SetField(Fields.NEXTLEVEL_XP, 200);
            SetField(Fields.MIN_DAMAGE, 0);
            SetField(Fields.BASEATTACKTIME0, 1f);

            for (int i = 0; i < 32; i++)
            {
                SetField(Fields.EXPLORED_ZONES + i, 0xFFFFFFFF);
            }

            // FillInPartialObjectData
            writer.WriteUInt8(MaskSize); // UpdateMaskBlocks
            writer.Write(MaskArray);
            foreach (var kvp in FieldData)
            {
                writer.Write(kvp.Value); // Data
            }
            return(writer);
        }
Beispiel #4
0
        public override IPacketWriter BuildUpdate()
        {
            MaskSize = ((int)Fields.MAX + 31) / 32;
            FieldData.Clear();
            MaskArray = new byte[MaskSize * 4];

            PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_UPDATE_OBJECT], "SMSG_UPDATE_OBJECT");

            writer.WriteUInt32(1);         // Number of transactions
            writer.WriteUInt8(2);          // UpdateType
            writer.WriteUInt64(Guid);      // ObjectGuid
            writer.WriteUInt8(4);          // ObjectType, 4 = Player

            writer.WriteUInt64(0);         // TransportGuid
            writer.WriteFloat(0);          // TransportX
            writer.WriteFloat(0);          // TransportY
            writer.WriteFloat(0);          // TransportZ
            writer.WriteFloat(0);          // TransportW (TransportO)

            writer.WriteFloat(Location.X); // x
            writer.WriteFloat(Location.Y); // y
            writer.WriteFloat(Location.Z); // z
            writer.WriteFloat(Location.O); // w (o)

            writer.WriteFloat(0);          // Pitch

            writer.WriteUInt32(0);         // MovementFlagMask
            writer.WriteUInt32(0);         // FallTime

            writer.WriteFloat(2.5f);       // WalkSpeed
            writer.WriteFloat(7.0f);       // RunSpeed
            writer.WriteFloat(4.7222f);    // SwimSpeed
            writer.WriteFloat(3.14f);      // TurnSpeed

            writer.WriteUInt32(1);         // Flags, 1 - Player
            writer.WriteUInt32(1);         // AttackCycle
            writer.WriteUInt32(0);         // TimerId
            writer.WriteUInt64(0);         // VictimGuid

            SetField(Fields.OBJECT_FIELD_GUID, Guid);
            SetField(Fields.OBJECT_FIELD_TYPE, 0x19);
            SetField(Fields.OBJECT_FIELD_ENTRY, 0);
            SetField(Fields.OBJECT_FIELD_SCALE_X, Scale);
            SetField(Fields.UNIT_FIELD_HEALTH, Health);
            SetField(Fields.UNIT_FIELD_POWER1, Mana);
            SetField(Fields.UNIT_FIELD_POWER2, 0);
            SetField(Fields.UNIT_FIELD_POWER3, Focus);
            SetField(Fields.UNIT_FIELD_POWER4, Energy);
            SetField(Fields.UNIT_FIELD_MAXHEALTH, Health);
            SetField(Fields.UNIT_FIELD_MAXPOWER1, Mana);
            SetField(Fields.UNIT_FIELD_MAXPOWER2, Rage);
            SetField(Fields.UNIT_FIELD_MAXPOWER3, Focus);
            SetField(Fields.UNIT_FIELD_MAXPOWER4, Energy);
            SetField(Fields.UNIT_FIELD_LEVEL, Level);
            SetField(Fields.UNIT_FIELD_BYTES_0, ToUInt32(Race, Class, Gender, PowerType));
            SetField(Fields.UNIT_FIELD_BYTES_1, (uint)StandState);
            SetField(Fields.UNIT_FIELD_STAT0, Strength);
            SetField(Fields.UNIT_FIELD_STAT1, Agility);
            SetField(Fields.UNIT_FIELD_STAT2, Stamina);
            SetField(Fields.UNIT_FIELD_STAT3, Intellect);
            SetField(Fields.UNIT_FIELD_STAT4, Spirit);
            SetField(Fields.UNIT_FIELD_BASESTAT0, Strength);
            SetField(Fields.UNIT_FIELD_BASESTAT1, Agility);
            SetField(Fields.UNIT_FIELD_BASESTAT2, Stamina);
            SetField(Fields.UNIT_FIELD_BASESTAT3, Intellect);
            SetField(Fields.UNIT_FIELD_BASESTAT4, Spirit);
            SetField(Fields.UNIT_FIELD_DISPLAYID, DisplayId);
            SetField(Fields.UNIT_FIELD_MOUNTDISPLAYID, MountDisplayId);
            SetField(Fields.PLAYER_FIELD_NUM_INV_SLOTS, 14);
            SetField(Fields.PLAYER_BYTES, ToUInt32(Skin, Face, HairStyle, HairColor));
            SetField(Fields.PLAYER_XP, 47);
            SetField(Fields.PLAYER_NEXT_LEVEL_XP, 200);
            SetField(Fields.PLAYER_BYTES_2, ToUInt32(b2: FacialHair));
            SetField(Fields.PLAYER_BASE_MANA, Mana);

            // FillInPartialObjectData
            writer.WriteUInt8(MaskSize); // UpdateMaskBlocks, 20
            writer.Write(MaskArray);

            foreach (var kvp in FieldData)
            {
                writer.Write(kvp.Value); // Data
            }
            return(writer);
        }