diff options
author | Nay <dnpd.dd@gmail.com> | 2012-01-17 04:37:55 -0800 |
---|---|---|
committer | Nay <dnpd.dd@gmail.com> | 2012-01-17 04:37:55 -0800 |
commit | 8604d6d69bd88b776763eef15ec54aa76d5b62af (patch) | |
tree | 81a72ca9d96c85b4d1fdb2e818fa8404469ae796 | |
parent | f1cc8f532efefb659ef86e3ac16110e9b0b70adb (diff) | |
parent | 37ffa978f70ed05073a281af9b74128598af8c32 (diff) |
Merge pull request #4848 from Subv/4.x
[4.x] Fixed SMSG_LIST_INVENTORY and added a run speed opcode
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 56 | ||||
-rwxr-xr-x | src/server/game/Server/Protocol/Handlers/ItemHandler.cpp | 60 | ||||
-rwxr-xr-x | src/server/game/Server/Protocol/Opcodes.h | 4 |
3 files changed, 99 insertions, 21 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 582b2e79596..39e9e077e3e 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12629,6 +12629,8 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) propagateSpeedChange(); WorldPacket data; + uint64 guid = GetGUID(); + uint8* bytes = (uint8*)&guid; if (!forced) { switch (mtype) @@ -12637,7 +12639,26 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) data.Initialize(MSG_MOVE_SET_WALK_SPEED, 8+4+2+4+4+4+4+4+4+4); break; case MOVE_RUN: - data.Initialize(MSG_MOVE_SET_RUN_SPEED, 8+4+2+4+4+4+4+4+4+4); + data.Initialize(SMSG_MOVE_SPLINE_SET_RUN_SPEED, 1 + 8 + 4); + data.WriteByteMask(bytes[7]); + data.WriteByteMask(bytes[2]); + data.WriteByteMask(bytes[1]); + data.WriteByteMask(bytes[3]); + data.WriteByteMask(bytes[5]); + data.WriteByteMask(bytes[6]); + data.WriteByteMask(bytes[4]); + data.WriteByteMask(bytes[0]); + + data.WriteByteSeq(bytes[6]); + data.WriteByteSeq(bytes[7]); + data.WriteByteSeq(bytes[4]); + data.WriteByteSeq(bytes[3]); + data.WriteByteSeq(bytes[2]); + data.WriteByteSeq(bytes[5]); + data.WriteByteSeq(bytes[0]); + data.WriteByteSeq(bytes[1]); + + data << float(GetSpeed(mtype)); break; case MOVE_RUN_BACK: data.Initialize(MSG_MOVE_SET_RUN_BACK_SPEED, 8+4+2+4+4+4+4+4+4+4); @@ -12665,7 +12686,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) return; } - data.append(GetPackGUID()); + /*data.append(GetPackGUID()); data << uint32(0); // movement flags data << uint16(0); // unk flags data << uint32(getMSTime()); @@ -12674,7 +12695,8 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) data << float(GetPositionZ()); data << float(GetOrientation()); data << uint32(0); // fall time - data << float(GetSpeed(mtype)); + data << float(GetSpeed(mtype));*/ + SendMessageToSet(&data, true); } else @@ -12696,7 +12718,28 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) data.Initialize(SMSG_FORCE_WALK_SPEED_CHANGE, 16); break; case MOVE_RUN: - data.Initialize(SMSG_FORCE_RUN_SPEED_CHANGE, 17); + data.Initialize(SMSG_FORCE_RUN_SPEED_CHANGE, 1 + 8 + 4 + 4 ); + data.WriteByteMask(bytes[1]); + data.WriteByteMask(bytes[0]); + data.WriteByteMask(bytes[7]); + data.WriteByteMask(bytes[5]); + data.WriteByteMask(bytes[2]); + data.WriteByteMask(bytes[4]); + data.WriteByteMask(bytes[3]); + data.WriteByteMask(bytes[6]); + + data.WriteByteSeq(bytes[1]); + + data << float(GetSpeed(mtype)); + + data.WriteByteSeq(bytes[6]); + data.WriteByteSeq(bytes[2]); + data.WriteByteSeq(bytes[3]); + data.WriteByteSeq(bytes[7]); + data.WriteByteSeq(bytes[4]); + data.WriteByteSeq(bytes[0]); + data.WriteByteSeq(bytes[5]); + data << uint32(0); break; case MOVE_RUN_BACK: data.Initialize(SMSG_FORCE_RUN_BACK_SPEED_CHANGE, 16); @@ -12723,11 +12766,6 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) sLog->outError("Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); return; } - data.append(GetPackGUID()); - data << (uint32)0; // moveEvent, NUM_PMOVE_EVTS = 0x39 - if (mtype == MOVE_RUN) - data << uint8(0); // new 2.1.0 - data << float(GetSpeed(mtype)); SendMessageToSet(&data, true); } } diff --git a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp index c733e1ac9b3..2146b8a89bb 100755 --- a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp @@ -730,25 +730,64 @@ void WorldSession::SendListInventory(uint64 vendorGuid) if (vendor->HasUnitState(UNIT_STAT_MOVING)) vendor->StopMoving(); + uint8* bytes = (uint8*)&vendorGuid; + VendorItemData const* items = vendor->GetVendorItems(); if (!items) { WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + 1); - data << uint64(vendorGuid); + data.WriteByteMask(bytes[5]); + data.WriteByteMask(bytes[6]); + data.WriteByteMask(bytes[1]); + data.WriteByteMask(bytes[2]); + data.WriteByteMask(bytes[3]); + data.WriteByteMask(bytes[0]); + data.WriteByteMask(bytes[7]); + data.WriteByteMask(bytes[4]); + + data.WriteByteSeq(bytes[2]); + data.WriteByteSeq(bytes[3]); + data << uint8(0); // count == 0, next will be error code - data << uint8(0); // "Vendor has no inventory" + data << uint8(0xA0); // Only seen 0xA0 (160) so far ( should we send 0 here?) + + data.WriteByteSeq(bytes[4]); + data.WriteByteSeq(bytes[7]); + data.WriteByteSeq(bytes[6]); SendPacket(&data); return; } uint8 itemCount = items->GetItemCount(); uint8 count = 0; - + WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + itemCount * 8 * 4); - data << uint64(vendorGuid); - + + data.WriteByteMask(bytes[5]); + data.WriteByteMask(bytes[6]); + data.WriteByteMask(bytes[1]); + data.WriteByteMask(bytes[2]); + data.WriteByteMask(bytes[3]); + data.WriteByteMask(bytes[0]); + data.WriteByteMask(bytes[7]); + data.WriteByteMask(bytes[4]); + + data.WriteByteSeq(bytes[2]); + data.WriteByteSeq(bytes[3]); + size_t countPos = data.wpos(); - data << uint8(count); + data << uint32(count); + + data.WriteByteSeq(bytes[5]); + data.WriteByteSeq(bytes[0]); + data.WriteByteSeq(bytes[1]); + + data << uint8(0xA0); // Only seen 0xA0 (160) so far + + data.WriteByteSeq(bytes[4]); + data.WriteByteSeq(bytes[7]); + data.WriteByteSeq(bytes[6]); + float discountMod = _player->GetReputationPriceDiscount(vendor); @@ -775,26 +814,27 @@ void WorldSession::SendListInventory(uint64 vendorGuid) // reputation discount int32 price = item->IsGoldRequired(itemTemplate) ? uint32(floor(itemTemplate->BuyPrice * discountMod)) : 0; + data << uint32(itemTemplate->MaxDurability); data << uint32(slot + 1); // client expects counting to start at 1 data << uint32(item->item); + data << uint32(0); // Always 0? data << uint32(itemTemplate->DisplayInfoID); data << int32(leftInStock); - data << uint32(price); - data << uint32(itemTemplate->MaxDurability); data << uint32(itemTemplate->BuyCount); data << uint32(item->ExtendedCost); + data << uint32(1); // Always 1? + data << uint32(price); } } } if (count == 0) { - data << uint8(0); SendPacket(&data); return; } - data.put<uint8>(countPos, count); + data.put<uint32>(countPos, count); SendPacket(&data); } diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 0bdfd6cc76e..ed657814d18 100755 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -485,7 +485,8 @@ enum Opcodes MSG_MOVE_SET_RUN_BACK_SPEED = 0x00, MSG_MOVE_SET_RUN_BACK_SPEED_CHEAT = 0x00, MSG_MOVE_SET_RUN_MODE = 0x21A4, - MSG_MOVE_SET_RUN_SPEED = 0x00, + SMSG_FORCE_RUN_SPEED_CHANGE = 0xE24E, // for self + SMSG_MOVE_SPLINE_SET_RUN_SPEED = 0xB2CE, // for others MSG_MOVE_SET_RUN_SPEED_CHEAT = 0x00, MSG_MOVE_SET_SWIM_BACK_SPEED = 0x00, MSG_MOVE_SET_SWIM_BACK_SPEED_CHEAT = 0x00, @@ -694,7 +695,6 @@ enum Opcodes SMSG_FORCE_MOVE_UNROOT = 0x00, SMSG_FORCE_PITCH_RATE_CHANGE = 0x00, SMSG_FORCE_RUN_BACK_SPEED_CHANGE = 0x00, - SMSG_FORCE_RUN_SPEED_CHANGE = 0x00, SMSG_FORCE_SEND_QUEUED_PACKETS = 0x1380, SMSG_FORCE_SWIM_BACK_SPEED_CHANGE = 0x00, SMSG_FORCE_SWIM_SPEED_CHANGE = 0x00, |