Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Links:
- * Link1: https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/Entities/Object/Updates/UpdateData.h
- * Link2: https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/Entities/Object/ObjectGuid.h
- * Link3: https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/Entities/Unit/Unit.h
- * Link4: https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/Entities/Object/Updates/UpdateFields.h
- */
- SMSG_UPDATE_OBJECT {
- // Total number of Update Blocks in this packet
- uint32_t updateBlockCount;
- UPDATE_BLOCK {
- // Update Type: see enum OBJECT_UPDATE_TYPE in Link1
- uint8_t updateType;
- // Bitmask (type uint8_t) + non-zero GUID bytes:
- uint*_t *packedGUID;
- // Object Type: see enum TypeID in Link2
- uint8_t objectType;
- //------------------------------
- // Movement Update Block:
- //------------------------------
- // Update Flags: see enum OBJECT_UPDATE_FLAGS in Link1
- uint16_t updateFlags;
- if (UPDATEFLAG_LIVIING) {
- // Movement Flags: see enum MovementFlags in Link3
- uint32_t movementFlags;
- // Extra Movement Flags: see enum MovementFlags2 in Link3
- uint16_t extraMovementFlags;
- // Time stamp
- uint32_t time;
- // Object position (x, y, z)
- float position[3];
- // Object orientation
- float orientation;
- if (MOVEMENT_FLAG_ONTRANSPORT) {
- // Packed GUID of transportation object that is transporting this object
- uint8_t *transportGUID;
- // Position of the transportation object(x, y, z, o)
- float transportPosition[4];
- uint32_t transportTime;
- // Seat number on the transportation object that this object occupies
- uint8_t transportSeat;
- if (MOVEMENTFLAG2_INTERPOLATED_MOVEMENT) {
- uint32_t transportTime;
- }
- }
- if (MOVEMENT_FLAG_SWIMMING | MOVEMENT_FLAG_FLYING | EXTRA_MOVEMENT_FLAG_ALWAYS_ALLOW_PITCHING) {
- float swimPitch;
- }
- uint32_t fallTime;
- if (MOVEMENT_FLAG_FALLING) {
- float fallVelocity;
- float fallSinAngle;
- float fallCosAngle;
- float fallSpeed;
- }
- if (MOVEMENT_FLAG_SPLINE_ELEVATION) {
- float splineElevation;
- }
- // Movement Speeds (in this order):
- // MOVE_WALK, MOVE_RUN, MOVE_RUN_BACK,
- // MOVE_SWIM, MOVE_SWIM_BACK, MOVE_FLIGHT,
- // MOVE_FLIGHT_BACK, MOVE_TURN_RATE, MOVE_PITCH_RATE
- float speeds[9];
- if (MOVEMENT_FLAG_SPLINE_ENABLED || hasSplineData) {
- uint32_t splineFlags;
- if (SPLINE_FLAG_FINAL_TARGET) {
- uint64_t finalSplineTargetGUID;
- }
- else if (SPLINE_FLAG_FINAL_ORIENTATION) {
- float finalSplineOrientation;
- }
- else if (SPLINE_FLAG_FINAL_POINT) {
- float finalSplineCoords[3];
- }
- uint32_t splineTime;
- uint32_t splineFullTime;
- uint32_t splineID;
- float splineDurationMultiplier;
- float splineDurationMultiplierNext;
- float splineVerticalAcceleration;
- uint32_t splineStartTime;
- uint32_t splineCount;
- float splineWayPoint[splineCount][3];
- uint8_t splineMode;
- float splineEndPoint[3];
- }
- }
- else { // !UPDATE_FLAG_LIVIING
- if (UPDATE_FLAG_GO_POSITION) {
- uint8_t *goTransportPackedGUID;
- float goPosition[3];
- float transportOffsets[3];
- float goOrientation; //=transportOffsets orientation
- float corpseOrientation
- }
- else if (UPDATE_FLAG_STATIONARY_OBJECT) {
- float stationaryPosition[3];
- float stationaryOrientation;
- }
- }
- // I fail to see the point of this 2 flags, since you have to send packed GUID of this object
- // at the very beginning of the update block but oh well.
- if (UPDATE_FLAG_UNKNOWN_1) { //0x008 // HIGH GUID
- uint32_t unknown1;
- }
- if (UPDATE_FLAG_LOW_GUID) {
- uint32_t lowGUID;
- }
- if (UPDATE_FLAG_ATTACKING_TARGET) {
- uint8_t *targetPackedGUID;
- }
- if (UPDATE_FLAG_TRANSPORT) {
- uint32_t unknownTransportTimer;
- }
- if (UPDATE_FLAG_VEHICLE) {
- uint32_t vehicleID;
- float vehicleOrientation;
- }
- // Copied, ripped-off magic from I can't remember where. Never tested this myself.
- if (UPDATE_FLAG_GO_ROTATION) {
- uint64_t packedQuarternion; // -> packed
- /*//Magic:
- float x = (packed >> 42)*(1.0f/2097152.0f);
- float y = (((packed << 22) >> 32) >> 11)*(1.0f/1048576.0f);
- float z = (packed << 43 >> 43)*(1.0f/1048576.0f);
- float w = x*x + y*y + z*z;
- if (Math.Abs(w - 1.0f) >= (1/1048576.0f))
- w = (float) Math.Sqrt(1.0f - w);
- else
- w = 0.0f;
- */
- }
- //-----------------------------
- // Values update block
- //-----------------------------
- // Depends on object Type:
- // For player it's (PLAYER_END + 31) / 32, where PLAYER_END is enum
- // value from Link4.
- // Basically you allocate enough DWORDs that can hold all values update flags
- uint8_t maskSize;
- // Values update mask
- uint32_t updateMask[maskSize];
- for every bit set in "updateMask"
- uint32_t updateField;
- }
- }
Add Comment
Please, Sign In to add comment