Public feed #376576

Anonymous

public text v1 · immutable
Raw Edit
·published 2007-03-01 03:29 UTC
rendered paste body
public void SendUpdateObject(RealmSession session, UpdateTypes updateType)
        {
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_UPDATE_OBJECT))
            {
                packet.WriteBE(1);// block count.
                packet.WriteByte(0);// unk constant
                // start repeat
                packet.WriteByte((byte)updateType); // update type
                packet.Write(GetPackedGUID(session.ActiveCharacter.GUID)); // packed guid
                packet.WriteByte(0x04); // player object type
                packet.WriteByte(0x71); //flag1
                packet.WriteBE(0x2000);// flag2
                packet.WriteBE(0xB74D85D1);// reverse?
                packet.WriteBE(session.ActiveCharacter.PosX);
                packet.WriteBE(session.ActiveCharacter.PosY);
                packet.WriteBE(session.ActiveCharacter.PosZ);
                packet.WriteBE(0.0f); // orientation
                packet.WriteBE(0);
                if (updateType == UpdateTypes.CreateSelf)
                {
                    packet.WriteBE(0.0f);
                    packet.WriteBE(1.0f);
                    packet.WriteBE(0.0f);
                    packet.WriteBE(0.0f);
                }
                packet.WriteBE(20f); //walk
                packet.WriteBE(20f); // run
                packet.WriteBE(20f); // swimback
                packet.WriteBE(20f); //swim
                packet.WriteBE(20f); //walkback
                packet.WriteBE((float)Math.PI); //turn
                packet.WriteBE(20f); // fly
                packet.WriteBE(20f); // flyback

                UpdateMask mask = new UpdateMask((int)PlayerFields._Count);
                mask.SetBit((int)ObjectFields.Guid);// guidlow
                mask.SetBit((int)ObjectFields.Guid+1);//guidhigh
                mask.SetBit((int)UnitFields.UnitBytes0);//(int)UnitFields.UnitBytes0);
                mask.Write(packet);
                packet.WriteBE((long)session.ActiveCharacter.GUID); // full guid

                packet.WriteByte(0);// powertype  
                packet.WriteByte((byte)session.ActiveCharacter.Gender);
                packet.WriteByte((byte)session.ActiveCharacter.Class);
                packet.WriteByte((byte)session.ActiveCharacter.Race);   // unit bytes 0 is a uint so it must also be reversed.

                session.Send(packet);
            }
        }